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

how do i make a while object does not exist loop?

my attempt:

local OBJECT = Instance.new('ScreenGui')
OBJECT.Parent = nil
while OBJECT.Parent = nil do
end

please help!

1 comment

0

So you're saying that your object has no parent. If you have a script to assign a parent, you should probably use a repeat loop with the until

2 answers

Your loop needs some sort of delay or stop in order to avoid crashing your computer.

local OBJECT = Instance.new('ScreenGui')
OBJECT.Parent = nil
while OBJECT.Parent == nil do
wait() -- While functions that go on infinietly should have this
end

while it doesn't exist or while it exists?

local OBJECT = Instance.new('ScreenGui')
OBJECT.Parent = nil
while OBJECT.Parent == nil do --you forgot the extra '='
	wait()
end

also technically the object still exists, you can parent it to another instance and it will move

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