I want to detect when a player sits in the driver seat and if that happens delete the folder the script is in Here is my script
seat = script.Parent.Parent
car = script.Parent.Parent.Parent
function onTouched(part)
while true do
wait(.1)
local h = part.Parent:FindFirstChild("Humanoid")
if (h.Sit == true) then
script.Parent:Destroy()
end
end
end
Sadly it didn't work It's not really needed to delete the folder I just want to stop the script when a player is on a seat Any help?

7 comments
Could you show me your explorer? Your explanation is making me confused.
Also, you do realize you need to run the function by command?
I'm not the best scripter so I'm just trying to find out what's wrong and hope I get a fix
The thing I need is if a player sits in the driver seat I want the script to destroy the folder it's in. Here is my explorer: https://gyazo.com/04942fc92e266bd38b7c7e4a7e6e79fd
There is a despawn script inside the folder too so I want the despawn script to be disabled or destroyed when someone sits on the seat
uh I already see the problem.
Ok well after adding an end to the script it still doesn't do what I need it to do