I am currently trying to see if I completely understand how the Debounce and seeing if the it's a player who touched the part. But when I run the script, it says attempt to call method 'Touched' (a userdata value)
Here's the code,
function OnTouched(part) Debounce = false player = part.Parent:FindFirstChild("Humanoid") if not player then player2 = player.Parent:FindFirstChild("Humanoid") end if not Debounce then Debounce = true if player or player2 then print("It worked!") end wait(3) end Debounce = false end script.Parent:Touched(OnTouch)
Touched
is not a method, as it is an event. In the true nature of events, you need to be using them as events.
The correct line is
script.Parent.Touched:connect(OnTouch)
Remember it, because that mistake is lazy.