local HitT = true function OnTouched(part) local humanoid = part.Parent:FindFirstChild("Humanoid") script.Parent.Hit:Play() if (humanoid ~= nil) then if HitT then HitT = false humanoid.PlatformStand = true print("he touched me") wait(2) humanoid.PlatformStand = false HitT = true end end end script.Parent.Touched:connect(OnTouched)
no error btw.
Use a debounce.
local HitT = true local db = false local waitTime = 1 --how long to wait so that it doesn't spam stun function OnTouched(part) if db then return nil end db = true local humanoid = part.Parent:FindFirstChild("Humanoid") script.Parent.Hit:Play() if (humanoid ~= nil) then if HitT then HitT = false humanoid.PlatformStand = true print("he touched me") wait(2) humanoid.PlatformStand = false HitT = true wait(waitTime) db = false end end end script.Parent.Touched:connect(OnTouched)