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.
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)