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)

local sign = script.Parent.Parent.P_cel.SurfaceGui.TextLabel
local cd = script.Parent.ClickDetector

cd.MouseClick:Connect(function(plr)
    sign.Text = plr.Name and "asks you to open the gate.
end)

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

1 answer

Log in to vote
1
Answered by
IcyMizu 122
4 years ago
local sign = script.Parent.Parent.P_cel.SurfaceGui.TextLabel
local cd = script.Parent.ClickDetector

cd.MouseClick:Connect(function(plr)
    sign.Text = plr.Name.."asks you to open the gate."
end)

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

Ad

Answer this question