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

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

Asked by 7 years ago

my attempt:

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

please help!

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 commag 228 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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

Ad
Log in to vote
0
Answered by 7 years ago

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

Answer this question