First off, to make your code "more efficient" for future work, you can replace "checker == true" with just "checker". You can also replace the "==nil" with "not" at the beginning:
while checker do
wait(0.1)
if not OakWood then
print("Nil")
checker = false
end
end
This isn't keeping the script from working, it's just a more professional way of writing the code.
Another way that might work rather than just using a loop like this is to connect the model to an AncestryChanged event, and if the ancestor is nil then the function connected to the event would trigger:
OakWood.AncestryChanged:connect(function(inst, parent)
if not parent and checker then
print("Nil")
checker = false
end)
However, if your original code doesn't work, this likely won't, either. Try throwing in a print between the wait(0.1) and the "if...then" line to make sure checker == true. |