This is my code.
local part = script.Parent --part
`while true do`
wait(0.05)
part.Touched:Connect(function()
local z = 0
wait(1)
z = z + 1
part.TouchEnded:Connect(function()
z = 0
end)
if z == 5 then
print("got it")
end
end)
end
I want it so if they are touching it for more then 5 seconds it should print got it, but I reserved no message in the output view, not even an error. I would really appreciate some help!!

4 comments
Don't use a loop for this; it's just going to keep setting up
touchedevents every time the loop fires.GetTouchingParts
what should I do then??
while #part:GetTouchingParts() > 0 do