Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Am I doing something wrong?

Asked by 8 years ago

I made this punch script when the player clicks their mouse but it does no damage, I put the punch script in a Local Script and the Damage Script in a regular script. I did this because when I had them in one script it would only work for the local player. Please help!

Damage script:

plr = script.Parent.Parent.Parent
char = plr.Character

local damage = 5

local swing = script.Parent:WaitForChild("Swing").Value

char:WaitForChild("Right Arm").Touched:connect(function(hit)
    if swing.Value == true then
        local hum = hit.Parent:FindFirstChild("Humanoid") 
        if hum ~= nil then
            print("Hurting "..hit.Parent.Name.."!")
            hum.Health = hum.Health - damage
            --hum:TakeDamage(damage)
            hum.WalkSpeed = 0
            wait(.6)
            hum.WalkSpeed = 16
        end
    end
end)
--------------------------------------------------------------------------
0
Is FE on? User#11440 120 — 8y
0
Yes NICCO890 35 — 8y

Answer this question