I have tried a script, and searched the web. and I found one which almost works. Only the wheels are left. It has the and wheels in a different model, within the entire carmodel. The script is inside of the Vehicle seat inside of the body.
local seat = script.Parent local vehicle = seat.Parent while true do wait(10) if not seat.Occupant then vehicle:Destroy() end end
is what I have tried, can someone please explain, or fix the issue.
Thanks
Put this script In the car model `` local car = script.parent
wait (20) car:Destroy``
I figured it out, I had 1 parent too little, so it didn't remove the entire model, thanks for the help :)
script.Parent.ChildRemoved:connect(function() wait(10) --How long it has to wait before removing script.Parent.Parent.Parent:remove()--It is a model inside a model inside a model, so 3 parent end)
Here is a simple fix! I think you messed up on line 6. A lot of people like to do if statements when values are true and false like "if not true then" but I like to do it like "if value ~= true then"
local vehicle = script.Parent local seat = script.Parent.Seat while true do wait(10) if seat.Occupant == nil then vehicle:Destroy() end end
This is a server script inside of a model.
Enjoy!