This is a tutorial because i couldnt find a actual forum telling you how to do it
local touching = false
script.Parent.Touched:Connect(function(hit) --checks if the player touched
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching=true
end
end)
script.Parent.TouchEnded:Connect(function(hit) --checks when the player stopped touching
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
touching=false
end
end)
coroutine.wrap(function()
while touching do -- While touching loop
task.wait()
--Your script here
end
end)()
Hope i helped