https://gyazo.com/fa223dee783ba1ddf28f8a093e7263d5
This script doesn't work and i don't know whats wrong with it. I mean it kills the "humanoid", but doesn't do 10 damage at a time, it just kills it instantly.
You need to have a debounce.
01 | local dmg = 10 |
02 | local debounce = false |
03 |
04 | script.Parent.Touched:connect( function (hit) |
05 | local char = hit.Parent |
06 | local human = char:FindFirstChild( "Humanoid" ) |
07 |
08 | if human then |
09 | if debounce = = false then |
10 | debounce = true |
11 |
12 | human:TakeDamage(dmg) |
13 |
14 | wait(*time in between attacks*) |
15 | debounce = false |
16 | end |
17 | end |
18 | end ) |
Here, use this script that I made some changes to:
01 | local ATTACK_DAMAGE = 10 |
02 | local ATTACK_DELAY = 1 |
03 |
04 | local rarm = script.Parent:FindFirstChild( 'Right Arm' ) |
05 | local larm = script.Parent:FindFirstChild( 'Left Arm' ) |
06 |
07 | local debounce = false |
08 |
09 | function dmg(hit) |
10 | if debounce = = false then |
11 |
12 | if hit and hit.Parent then --You don't have to do "hit ~= nil" .This works the same too. |
13 | local char = hit.Parent |
14 | if char:FindFirstChild( 'Humanoid' ) then |
15 | debounce = true |
Read this wiki for more information: https://wiki.roblox.com/?title=Debounce