So I’m trying to create a despawn script for my slot game, but I don’t think that this is the best way to write this script.
Currently when you get out of the car a 30 second timer starts and once that 30 seconds is up it checks again to see if anyone is in the car, but there are some bugs and glitches with this option. Also the way in my game that you spawn in cars is via the admin command :ins (AssetID) so some scripts don’t work properly.
This is my current script.
local seat = script.Parent
local car = seat.Parent
seat:GetPropertyChangedSignal('Occupant'):Connect(function()
if not seat.Occupant then
wait(30)
if not seat.Occupant then
car:Destroy()
end
end
end)
I would love to see some better ways on doing this,
Thanks F31!