Categories > Coding > Lua >
Change TextLabel's Text when its clicked to a button
Posted
local textm = "I eat some Doritos" -- Text that you want to show
local textbox = script.Parent.Parent.TextBox -- Textbox script
script.Parent.MouseButton1Click:Connect(function()
textbox.Text = textm
end)
Make a script and put that
Cancel
Post
https://cdn.discordapp.com/attachments/1041233366428696607/1120019992700801134/Ryzen.png
Replied
use .Activated instead of MouseButton1Click
Cancel
Post
"your code looks like a decompiled roblox script", - Whoman
Replied
Your script seems to be correct, but you need to make sure that the button and the textbox are in the same frame or screen GUI. You also need to name the button and the textbox according to your script.
Comments
Aetheron 5 Reputation
Commented
His script is though very generic and gives a general understanding of how a button works.
You just edit the variable to the path of your TextLabel or Textbox to modify the text,
I did not understand your point in this reply.
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Comments
EggEnthusiast 5 Reputation
Commented
.MouseButton1Down is also a good alternative.
0