function onClicked(playerWhoClicked) game.StarterGui.Magical.ScreenGui.TextLabel.Visible = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The Visible property of the Text Label is set to false.
The StarterGui
holds the Guis that are handed out to players when they spawn. However, since Guis are independent from player to player, each player contains a PlayerGui
within their Player
object.
If you want the changes to be visible to a player without them respawning, you must directly edit their PlayerGui
.
The ClickDetectors parameter playerWhoClicked
holds the Player
object of the player who clicked it.
So using this information, this script should work:
function onClicked(playerWhoClicked) playerWhoClicked.PlayerGui.Magical.ScreenGui.TextLabel.Visible = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Additional Resources:
StarterGui
And never again
You want to use playerWhoClicked.PlayerGui
instead of StarterGui, as StarterGui only updates when the Player respawns, and changes universally.
function onClicked(playerWhoClicked) playerWhoClicked.PlayerGui.Magical.ScreenGui.TextLabel.Visible = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)