Beginner scripter who has made a car despawning script. The script properly ads up the 'Seconds' Int value until reaching 20. When it reaches 20 it deletes the car as it should, however when getting into the car the Int Value doesn't go to 0 but instead continues climbing. I suspect this is something to do with my Loop of If statement.
And help appreciated, thanks in advance.
Secs = script:FindFirstChild("Seconds") Occupant = script.Parent.Occupant car = script.Parent.Parent while true do wait(1) if Occupant == nil then Secs.Value = Secs.Value + 1 if Secs.Value == 20 then car:Destroy() end elseif Occupant ~= nil then Secs.Value = Secs.Value - Secs.Value print("hello") end end
-should also add that "hello" isn't being printed either