ADD gui to all players

hello. im trying to move a gui object to each player after 4 seconds. but somehow its not including everyone.

code:

task.wait(4)
for a,b in ipairs(game.Players:GetChildren()) do
	local Gui = script.GUI.Value:Clone()
	Gui.Parent = b.PlayerGui
end
task.wait()
script.CUTSCENE_CONTROLLER:Fire()
task.wait(2 * 16)
for a,b in ipairs(game.Players:GetChildren()) do
	if b.PlayerGui:FindFirstChild(script.GUI.Value.Name) then
		b.PlayerGui:FindFirstChild(script.GUI.Value.Name):Destroy()
	end
end
script.CUTSCENE_MODEL.Value:Destroy()

test the script here: [LIBARY LOCK] DOORS REFRESHED - Roblox

try for _, b in ipairs()
_, specifies you want to run it for all players

um no it doesnt. its just a parameter. if it isnt, show me the docs showing it

1 Like

_, means you dont care how many times the function is run, you want it to run every single iteration, which in this case, is all players

you got proof for that being an actual fact?

oop just realised yeah im wrong sorry

_, is used for when you dont need a number for your script, sorry!

task.wait(4)
for _, b in game.Players:GetPlayers() do
	script.GUI.Value:Clone().Parent = b.PlayerGui
end --this loop should be serversided
task.wait()
script.CUTSCENE_CONTROLLER:Fire()
task.wait(32)
for _, b in game.Players:GetPlayers() do
	if b.PlayerGui:FindFirstChild(script.GUI.Value.Name) then
		b.PlayerGui:FindFirstChild(script.GUI.Value.Name):Destroy()
	end
end
script.CUTSCENE_MODEL.Value:Destroy()