I have simple code that removes a boat if you board and exit:
script.Parent.ChildRemoved: connect (function () - this is a trigger which is essentialy checking to see if you jump from the seat
wait (10) —this line tells the code to wait 10 seconds
script.Parent.Parent: remove () —this line deletes the car
end)
But I would like the script to work immediately after the spawn of the boat (that is, immediately after the spawn of the boat, it is deleted after 10 seconds). Also, if you catch a boat, the timer (for 10 seconds in the script) stops, deletion does not occur, and when leaving the boat the timer starts from the beginning.
Please help, I don’t understand the code...

6 comments
You should learn how to code before you start making games.
boat:Destroy() -- rekt
This is whole wrong... I suggest you read up on more learning resources before you try to make a game.
You're supposed to have -- not just -
well use for loops
I already created the game without knowledge of scripts.