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

Npc attacking animation wont work u can fix this?

Asked by 5 years ago

its wont working

function onTouched(hit)
damage = 5
human.Health = human.Health - damage
script.Parent.Human:LoadAnimation(script.Parent.Slash):Play()
end

script.Parent.Touched:connect(onTouched)

Human = Humanoid but its enemy

1 answer

Log in to vote
0
Answered by
Imperialy 149
5 years ago
function onTouched(hit)
    damage = 5
    human.Health = human.Health - damage
    local track = script.Parent.Human:LoadAnimation(script.Parent.Slash):Play() -- means you loaded it in
    track:Play() -- must play the track
end

script.Parent.Touched:Connect(onTouched) -- always uppercase the connect it's preferred for signals
Ad

Answer this question