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

How i can make my punching animation do damage?

Asked by 7 years ago
Edited 7 years ago

I have another question, what can i also need to do to make my animation play one by one. like right punch press f next left punch press f again and kick press f again and again and again ?

    local plr = game.Players.LocalPlayer
    local UIS = game:GetService("UserInputService")

    UIS.InputBegan:connect(function(key, GPE) 
    if key.KeyCode == Enum.KeyCode.F and not GPE then 

    local anim1 = plr.Character.Humanoid:LoadAnimation(script.Animation1) 
    local anim2 = plr.Character.Humanoid:LoadAnimation(script.Animation2)
    local anim3 = plr.Character.Humanoid:LoadAnimation(script.Animation3)



    anim1:Play() 
    wait(0.5) 
    anim1:Stop()
    anim2:Play()
    wait(0.5)
    anim2:Stop()
    anim3:Play()
    wait(0.5)
    anim3:Stop()
    end
    end)

1
How i can post my script here so that i know what i need to change or to add. OniSanYamate -17 — 7y
0
press the lua buttona nd iside of the ~~ put your code e.g ~~--code ~~ abnotaddable 920 — 7y
0
Thanks. OniSanYamate -17 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() -- Gets the local player obj or waits until it adds
local char = plr.Character or player.CharacterAdded:Wait() -- Gets the character obj or waits until it adds
local hum = char:FindFirstChild("Humanoid")
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(key, GPE)  -- Why connect?? Use Connect!
if key.KeyCode == Enum.KeyCode.F and not GPE then 

local anim1 = hum:LoadAnimation(script.Animation1) 
local anim2 = hum:LoadAnimation(script.Animation2)
local anim3 = hum:LoadAnimation(script.Animation3)

anim1:Play() 
wait(0.5) 
anim1:Stop()
If key.KeyCode == Enum.KeyCode.F and not GPE then
anim2:Play()
wait(0.5)
anim2:Stop()
end
If key.KeyCode == Enum.KeyCode.F and not GPE then
anim3:Play()
wait(0.5)
anim3:Stop()
end
end
end)

If this answer helped, if not, ask as many questions if you want(I was in a rush)

0
Sir ? it can do damge? Thanks for your time :D OniSanYamate -17 — 7y
0
Sir it also the same. i want to make my animation like not spamming. Cause everytime i click the key for the anim again and again my char looks like have a seizure. OniSanYamate -17 — 7y
0
And like right punch press f. left punch press f then kick press f. Not if i press f just one all the anim plays. OniSanYamate -17 — 7y
Ad

Answer this question