Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to change the Text of who clicked?

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

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)


2 comments

0

Still doesn't work. Not sure why but the Gui remains unchanged.

0

Any output error?

This discussion is preserved as it was. New answers, comments, and votes are closed.