01 | local HitT = true |
02 |
03 | function OnTouched(part) |
04 | local humanoid = part.Parent:FindFirstChild( "Humanoid" ) |
05 | script.Parent.Hit:Play() |
06 | if (humanoid ~ = nil ) then |
07 | if HitT then |
08 | HitT = false |
09 | humanoid.PlatformStand = true |
10 | print ( "he touched me" ) |
11 | wait( 2 ) |
12 | humanoid.PlatformStand = false |
13 | HitT = true |
14 | end |
15 | end |
16 | end |
17 |
18 | script.Parent.Touched:connect(OnTouched) |
no error btw.
Use a debounce.
01 | local HitT = true |
02 | local db = false |
03 | local waitTime = 1 --how long to wait so that it doesn't spam stun |
04 | function OnTouched(part) |
05 | if db then |
06 | return nil end |
07 | db = true |
08 | local humanoid = part.Parent:FindFirstChild( "Humanoid" ) |
09 | script.Parent.Hit:Play() |
10 | if (humanoid ~ = nil ) then |
11 | if HitT then |
12 | HitT = false |
13 | humanoid.PlatformStand = true |
14 | print ( "he touched me" ) |
15 | wait( 2 ) |