Hi, I would like to make it so that when the player jumps off the seat, the model is removed, but I have difficulties. My script works perfectly, but after I jump off and sit back down, the model is still removed after a while.
The problem is, no matter how much I tried to do it differently, the script stopped working, or nothing changed.
What i tried:
Turn off/on script
Copy, remove and paste back script
Return
My model hierarchy looks like this:
Model
Seat
Script
Parts
Part
Part
...
Script:
script.Parent:GetPropertyChangedSignal("Occupant"):Connect(function()
if script.Parent.Occupant ~= nil then
print("sit")
return
elseif script.Parent.Occupant ~= not nil then
wait(5)
script.Parent.Parent:remove()
end
end)
Please, help!

1 comment
Try removing the wait(5) so it instantly removes it. Also :remove() is deprecated use :Destroy() instead