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

Not working in game?

Basically, I want this StarterGui to pop up when a certain player is in the playerlist, in this case, my name. The script works perfectly fine on Studio but for some reason, when I try it in game, it doesn't even show. From what I can see, no errors are present. The Gui is in the StarterGui tab and the script (LocalScript) is running in the StarterPack tab (as this was the only place where it worked on Studio). Any help resolving this will be appreciated.

if game.Players.LocalPlayer.Name == "toughjohncena1256" or "Player1"
	then
game.StarterGui.cars.ScrollingFrame.Visible = true
game.StarterGui.cars.TEXT1.Visible = true
game.StarterGui.cars.TEXT2.Visible = true
game.StarterGui.cars.TEXT3.Visible = true
game.StarterGui.cars.TEXT4.Visible = true
end




1 answer

✓ Accepted answer

The reason your code is not working is because you're accessing starterGUI instead of the players GUI. Also, you will want to wait for the Player's GUI to load.

local plr = game.Players.LocalPlayer
plr:WaitForChild("PlayerGui")-- wait for GUI 
if plr.Name == "toughjohncena1256" or plr.Name == "Player1" then
    plr.PlayerGui.cars.ScrollingFrame.Visible = true
    plr.PlayerGui.cars.TEXT1.Visible = true
    plr.PlayerGui.cars.TEXT2.Visible = true
    plr.PlayerGui.cars.TEXT3.Visible = true
    plr.PlayerGui.cars.TEXT4.Visible = true
end

That should work. Good luck!

5 comments

0

Thank you for your reply. It works when I play solo, but I cannot play the game as it is just a saved project on Studio. Whenever I try to transport it to another game, it doesn't even work when played solo. Any ideas?

0

I've never had this problem so I don't think I can help you but you should make sure you publish your game to Roblox. But that's all I've got. Like I said, Im not the person to be asking such a question.

0

I've published it, and it works fine. Only trouble is I'm trying to place it into somewhere which already has stuff there, so I can't publish it to that place, otherwise I'll lose everything already there. However, thank you for your help.

0

Nevermind, got it to work. Thanks. :)

0

<3

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