I need help with getting players and making their gui visible for 2 seconds.
players = game.Players:GetChildren() for i,v in pairs (players) do players.PlayerGui.TimeNote.Timer2.Visible = true wait(2) players.PlayerGui.TimeNote.Timer2.Visible = false end
Your issue is that you're accessing the player wrong, the script below accesses the player in the correct way.
players = game.Players:GetChildren() for i,v in pairs (players) do -- When doing loops you use the second variable you create as the "child" v.PlayerGui.TimeNote.Timer2.Visible = true wait(2) v.PlayerGui.TimeNote.Timer2.Visible = false end
Hope this helped!
Sincerely, jmanrock123
Here's a fixed version of your script:
for _, player in pairs(game.Players:GetChildren()) do spawn(function() player.PlayerGui.TimeNote.Timer2.Visible = true wait(2) player.PlayerGui.TimeNote.Timer2.Visible = false end) end
What you were doing wrong is referencing the player incorrectly. You also should use spawn
to spawn the function, else this will happen for one player after the next and not at the same time.
What spawn
does is run a function, but still continue with the rest of the code without stopping if there's a pause (like using wait
).
I hope this helps! Good luck.