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

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

Asked by
Benqazx 108
8 years ago
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?

0
Yes. TheDeadlyPanther 2460 — 8y
0
ok Benqazx 108 — 8y
0
so will this make the frame visible for every player in the game or just 1 player? Benqazx 108 — 8y
0
All Wutras 294 — 8y

2 answers

Log in to vote
2
Answered by
Acheo 230 Moderation Voter
8 years ago

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
0
ok cool thanks but will this only work for 1 player or all the players in the game? Benqazx 108 — 8y
0
Upvote me if you could please, thanks. I hope I could help. Acheo 230 — 8y
Ad
Log in to vote
-2
Answered by 8 years ago

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

Answer this question