Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Every time I try to make my animation do damage it doesn't work, so what do I need to do?

local player = game:GetService("Players").LocalPlayer
local character = player.Character 
local humanoid = character:WaitForChild("Humanoid")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://848997334"
function playAnimation(Anim)
    local track = humanoid:LoadAnimation(Anim)
    track:Play()
end
game:GetService("UserInputService").InputBegan:connect(function(input ,proc)
    if not proc then
        if input.KeyCode == Enum.KeyCode.F then
	playAnimation(anim)
        end
    end
end)

1 answer

You can't do damage with animation. You can deal damage by Touching an arm so for example

LeftArm.Touched:Connect(function(h)
	local H = h.Parent:FindFirstChild('Humanoid')
	H.Health = H.Healht - 10
end)

so try changing the script

10 comments

0

I was able to do it to the dummy, but I don't know how to set it to the player.

0

What you mean set it by player?

0

The dummy's left arm hurts me and npcs, but my left arm does not.

0

And I'm wondering how to make MY left arm hurt people

0

then do it for you

0

local player

0

I know what I need to insert into the code to make it for the dummy, but I don't know what to insert into the code to make it go on the player's arm

0

local player doesnt worrk

0

I figured it out, I set it to Player1, but I have to enable it manually. How do I make it do it automatically?

0

If it's a server script then duh it won't work, add a script that when the animation on the player plays if it touches an arm the find the humanoid and do damage.

This discussion is preserved as it was. New answers, comments, and votes are closed.