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

Why doesnt this change in game?

Asked by 8 years ago

Why isnt this working???

function onClicked()
    game.StarterGui.Scoreboard.Frame.Away.Text = script.Parent.ORL.Name
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

Log in to vote
1
Answered by 8 years ago

The GUI a player sees is not inside of StarterGui. StarterGui is the GUI's that become given to a player when they join the game. The given GUI's are then put inside of the Players PlayerGui which is what they actually see. So to fix this, you want to get the GUI inside of the Players PlayerGui instead.

First, I'll let you know that ClickDetector's MouseClick gives you the player that has clicked, now we know who did it, so we can change their GUI. Look bellow for the functional script and some commenting on what is happening.

function onClicked(PlayerThatClicked) -- This can be anything, it can just be Player if you'd want.
    PlayerThatClicked.PlayerGui.Scoreboard.Frame.Away.Text = script.Parent.ORL.Name -- get THEIR Gui
end

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

If this works and helped you, please accept the answer, if it does not then comment, you can comment any questions too and I'll answer as well.

Ad

Answer this question