I want to know how to make a while true function to see if an object still exist. If the object exists, then it keeps running. I thought of this but it was kinda wierd.
while game.Workspace:FindFirstChild("Arrow") do
end
I want to know how to make a while true function to see if an object still exist. If the object exists, then it keeps running. I thought of this but it was kinda wierd.
while game.Workspace:FindFirstChild("Arrow") do
end
Its simple, start the loop and use if ...:FindFirstChild(...) then
Here is a example:
while true do -- Start a loop (Do not use while wait() do, its not a good way.)
if workspace:FindFirstChild("ITEM") then -- Item location
-- Your code here.
else
break -- End loop if object not found
end
wait(0.3) -- For no bugs / lag in game
end
But is better use .Changed
Hope it helped :)
Errors? tell-me on comments.
Wiki pages:
thank you so much
While true do wait() if game.Workspace.Part ~= nil then --Checks if the part is there ' --your code goes else --if the part is not there break --the loop will break end end
his code means the same thing
This is incorrect, use :FindFirstChild() and if part does not exist return a error. How to format answers/questions: https://forum.scriptinghelpers.org/topic/82/how-to-format-questions-answers-on-the-main-site
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
thats fine, but you could also make use of the .Changed event