Hi, I was making a script in which When you enter a car and drive and when you jump off the car (getting out of the car) The car gets deleted. But, When I tested it, The car did not get deleted. The script is written in NormalScript and It is placed Inside an Model called Car and inside the model Car it is placed in a VehicleSeat called DriversSeat. The code is here:
car = script.Parent.Parent function onTouched(part) while true do wait(.1) local h = part.Parent:FindFirstChild("Humanoid") if (h.Sit == false) then wait(50) if (h.Sit == false) then car:Remove() else h.Jump = false end end end end script.Parent.Touched:connect(onTouched)
Please let me know what error/mistake I have done. Thank you for reading/helping. :)
car = script.Parent.Parent function onTouched(part) while true do wait(.1) local h = part.Parent:FindFirstChild("Humanoid") if (h.Sit == false) then wait(50) if (h.Sit == false) then car:Remove()--its this remove this if you dont want it destroyed. else h.Jump = false end end end end script.Parent.Touched:connect(onTouched)
--xuefei123 i script