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

Whats wrong with this "For" Script?

--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?

3 comments

0

Are you running this from a LocalScript or using FilteringEnabled?

0

Is Players defined?

0

Its in Script,Workspace,And player is defined : Player = game.Players:GetChildren()

1 answer

✓ Accepted answer

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

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