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:
1 | function onClicked(playerWhoClicked) |
3 | playerWhoClicked.PlayerGui.Magical.ScreenGui.TextLabel.Visible = true |
7 | script.Parent.ClickDetector.MouseClick:connect(onClicked) |
Additional Resources:
MouseClick
StarterGui
PlayerGui
Arguments and Parameters