Debounce = false while task.wait() do local Zone = workspace:GetPartsInPart(script.Parent) for i, v in pairs(Zone) do if v.Name == "UpperTorso" and not Debounce then Debounce = true print("Player detected") wait(2) Debounce = false return end if Debounce == true then print("player left") wait(2) Debounce = false end end end
This works normally as a touch script, but i need it to print properly when the player enters and when the player leaves. Any help is appreciated! Edit: Replaced confusing words with more confusing words
Just solved it lol, i thought "Return" just broke the loop and brought it back to the top. fixed it with a proper break