I know how to do something when you step on a part (
function onTouch(hit)
-- hit is what I always put so I can do local player = game.Players:GetPlayerFromCharacter(hit.Parent)
-- Put code here bla bla bla
end
script.Parent.Touched:connect(onTouch)
) But I want to know how you can do something for the duration of while somebody is stepping on the part then do something else when they step off.
If you could help I would appreciate it!

2 comments
Thanks! I had heard about TouchEnded but didn't know if it would work in my situation. I will accept.
This almost helped with my situation. However, how can I make it stop constantly spamming between touched and touchEnded whenever the player moves?