Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Text doesn't appear when a button is clicked?

Asked by 4 years ago

So i want text to appear when someone clicks. It should display this: "[name of the player who clicked] asks you to open the gate." But instead it shows only the "asks you to open the gate" part. Help?

My most recent attempt: (it is a normal script)

1local sign = script.Parent.Parent.P_cel.SurfaceGui.TextLabel
2local cd = script.Parent.ClickDetector
3 
4cd.MouseClick:Connect(function(plr)
5    sign.Text = plr.Name and "asks you to open the gate.
6end)

What went wrong? And, it doesn't display any errors.

1 answer

Log in to vote
1
Answered by
IcyMizu 122
4 years ago
1local sign = script.Parent.Parent.P_cel.SurfaceGui.TextLabel
2local cd = script.Parent.ClickDetector
3 
4cd.MouseClick:Connect(function(plr)
5    sign.Text = plr.Name.."asks you to open the gate."
6end)

Hi so to connect strings u need to do this "Plr name".."This is a diffrent string"

Ad

Answer this question