Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Wich spot did i mess up the code?

Asked by 7 years ago
Edited 7 years ago
game.Players:connect(function(player)
player.PlayerGui.IntroGui.Frame.Visible = false
wait (2)
player.PlayerGui.IntroGui.Frame.Visible = true


end)
0
Codeblock please RubenKan 3615 — 7y

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You didn't add PlayedAdded.

game.Players.PlayerAdded:connect(function(player) --code end)

0
i just fixed it and it doesent seem to work. (i am new to scripting) darmantinjr 169 — 7y
0
could it be the cappitalization on game? darmantinjr 169 — 7y
0
game should be lowercase. RubenKan 3615 — 7y
0
My bad. RubenKan 3615 — 7y
View all comments (7 more)
0
aha thats how i have it... still nothing. I just don't get Lua darmantinjr 169 — 7y
0
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 darmantinjr 169 — 7y
0
also how do i change my writing into a script darmantinjr 169 — 7y
0
If you want your gui to appear when the character loads, just put the gui model inside StarterGui. RubenKan 3615 — 7y
0
yes but i would like it to wait until the character is loaded so they don't miss the intro darmantinjr 169 — 7y
0
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. Link150 1355 — 7y
0
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. Link150 1355 — 7y
Ad

Answer this question