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

My GUI script will only work in Studio and not in the Player, How can I fix this?

I've made a script that displays the player's name above a local gui but it only works in studio. I've tried this

playerName = game.Players.LocalPlayer.Name
game.StarterGui.HPGUI.Frame.Player.playerName.Text = playerName

1 comment

0

Have your tried putting the script in StarterPlayerScripts?

2 answers

✓ Accepted answer

The solution is very simple. You see, you're editing the StarterGui. The changes work in studio, but not in a game.

To fix this, just change StarterGui to PlayerGUI and a few other things

Final script:

player = game.Players.LocalPlayer -- Incase you need it for other needs, plus you can get the name in the line you call it.

player.PlayerGui.HPGUI.Frame.Player.playerName.Text = player.Name --Switched it to PlayerGUI, and changing playername to player.Name

Questions? Concerns? Make sure to ask!

Replace "StarterGui" with "PlayerGui", when dealing with LocalPlayers you don't access them via "StarterGui" but with "PlayerGui".

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