Idk why it is not working but I really need it to? If it’s not possible any alternatives not using loops?
Physics related properties on BaseParts doesn’t fire any on the changed events and that includes Position
property. You need to connect a function to a Heartbeat event to check for it.
I can’t use Heartbeat because the part is destroyed
Is there a reason you need to access the part after it is destroyed? Once you destroy something it’s supposed to be… destroyed.
No in my current loop I am using Position ~= OldPosition while true do loop but the part gets destroyed when the loop is running and it does not error it just creates a infinite loop
Why don’t you check if the part is destroyed and then break the loop?
Im afraid using findfirstchild is not the most efficient/least performance heavy way of doing it
What does findfirstchild have to do with this? Couldn’t you just do:
while part.Parent do
-- do what you what you would do with position --
runservice.HeartBeat:Wait()
end
FindFirstChild is quite efficient if you use it correctly, for example. I’ll check if it exists using an optimized method. This is quick, neat and optimised.
script.Parent.ChildRemoved:Connect(function(instance)
if not script.Parent:FindFirstChild("PutYourThingyHere") then
--etc
end
end)