Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Car gets deleted when you jump out of it script is not working, Help please?

Asked by 9 years ago

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. :)

1 answer

Log in to vote
0
Answered by
xuefei123 214 Moderation Voter
9 years ago

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

0
Please put in code block. PlayingOBC 70 — 9y
Ad

Answer this question