game.Players:connect(function(player)
player.PlayerGui.IntroGui.Frame.Visible = false
wait (2)
player.PlayerGui.IntroGui.Frame.Visible = true
end)
Wich spot did i mess up the code?
1 answer
You didn't add PlayedAdded.
game.Players.PlayerAdded:connect(function(player) --code end)
11 comments
i just fixed it and it doesent seem to work. (i am new to scripting)
could it be the cappitalization on game?
game should be lowercase.
My bad.
aha thats how i have it... still nothing. I just don't get Lua
i am trying to make my gui appear when the character loads... I have the screen gui's name set to IntroGui. the frame called Frame and i am trying to change the visibility of the frame
also how do i change my writing into a script
If you want your gui to appear when the character loads, just put the gui model inside StarterGui.
yes but i would like it to wait until the character is loaded so they don't miss the intro
From your use of PlayerGui, I assume this is a LocalScript. If so then the problem does not come from Lua itself, but rather from Roblox's client-server model. Connect()ing a function to the PlayerAdded event from the clientside (a LocalScript) will not detect when the LocalPlayer joins (when the Player object is created) as a LocalScript requires the player to have the LocalScript somehow.
Usually either in a Gui in PlayerGui, in its character model or in the player itself. Of course a LocalScript cannot get the player before it is created, and thus cannot run before PlayerAdded was fired for that player. The solution in this case is to not use PlayerAdded at all; A LocalScript will automatically run once the player receives it.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Codeblock please