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

Whats wrong with this "For" Script?

Asked by
iLegitus 130
9 years ago
--iLegimate--


for i = 1, #Players do 
    wait(32)
    Players[i].PlayerGui.TopFrame:remove()
    end

It turns out that i have a screenGui inside of the player's PlayerGUI's and after a certain amount of time,I'd like to remove it. But this unfortunately isnt working. Anybody can solve it?

0
Are you running this from a LocalScript or using FilteringEnabled? NoahWillCode 370 — 9y
0
Is Players defined? Perci1 4988 — 9y
0
Its in Script,Workspace,And player is defined : Player = game.Players:GetChildren() iLegitus 130 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Fixed the code for you:

for i = 1,#Players do
    delay(32,function() --Use the delay function to fire a function after a set time
        Players[i].PlayerGui.TopFrame:Destroy() --Use Destroy() instead of remove()
    end)
end
Ad

Answer this question