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

How to change the Text of who clicked?

Asked by 10 years ago

I have a Brick with a Click Detector and I am trying to make it so when you click, the TextLAbel on your screen changes. Right now it does not work.I need it to change the Gui for that player only. I know this doesn't work but I tried and it went wrong. Here is the little thing I got:


function onClicked(playerWhoClicked) game.StarterGui.Job.Jobname.Text = "Cashier" end script.Parent.ClickDetector.mouseClick:connect(OnClicked)

I know it's all wrong that's why I came here. Also should this be in a Local script? This is a normal Script inside the Brick with the ClickDetector.

1 answer

Log in to vote
0
Answered by 10 years ago

Your problem is that you are changing the StarterGui, rather than the PlayerGui, meaning the Gui will only update when the player dies. To get around this, you have to change the PlayerGui. Here's the fixed code:

function onClicked(player) --Your parameters were useless. Don't use parameters unless you have a use for it.
    player.PlayerGui.Job.Jobname.Text = "Cashier"


end

script.Parent.ClickDetector.mouseClick:connect(onClicked)


0
Still doesn't work. Not sure why but the Gui remains unchanged. CrispyBrix 113 — 10y
0
Any output error? SlickPwner 534 — 10y
Ad

Answer this question