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

is this how you use for i,v in pairs()do?

local players = game.Players:GetChildren()
for i,v in pairs(players) do
	v.PlayerGui.ScreenGui.Frame.Visible = true
end

is this how for i,v in pairs(players)do work?

4 comments

0

Yes.

0

ok

0

so will this make the frame visible for every player in the game or just 1 player?

0

All

2 answers

✓ Accepted answer

Incase a user doesn't have the gui and the script breaks, use this:

local players = game.Players:GetChildren()
for i,v in pairs(players) do
if v and v:FindFirstChild("PlayerGui") ~= nil and v.PlayerGui:FindFirstChild("ScreenGui") ~= nil then
    v.PlayerGui.ScreenGui.Frame.Visible = true
end
end

2 comments

0

ok cool thanks but will this only work for 1 player or all the players in the game?

0

Upvote me if you could please, thanks. I hope I could help.

Do you even know what for i, v are actually? and what GetChildren() does?

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