First of all, create animations.
Second, use this LINK to understand mechanics of animations.
And lastly, check Health property to see how you can damage the player.
Basically, there are a few examplesin these links that is very simple. For that, you need to insert "Animation" object into somewhere into the game, then you need to change their IDs to your animations' IDs. You said there are more than one animations so I will show you how to play animations randomly in each click. After you get your animations into a safe place(ServerStorage is pretty good for these stuff) you need to insert a LocalScript into StarterPack or StarterGui and, you can basically copy and paste this or read descriptions to fully understand and remake it. I am making it for three animations, you can change it later.
Anims = {
game.ServerStorage.Animations.Anim1,
game.ServerStorage.Animations.Anim2,
game.ServerStorage.Animations.Anim3
}
Busy = false
Damage = 5
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F then
if Busy == false then
Busy = true
RandomAnim = Anims[math.random(1,3)]
Player = script.Parent.Parent
Character = Player.Character
local animTrack = Character.Humanoid:LoadAnimation(RandomAnim)
animTrack:Play()
Hit = false
Character["Right Arm"].Touched:connect(function(TP)
if Hit == false then
if TP.Parent:FindFirstChild("Humanoid") then
TP.Parent.Humanoid.Health = TP.Parent.Humanoid.Health - Damage
Hit = true
end
end
end)
Busy = false
end
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
I hope this helped you! Took my 20 minutes to type descriptions, study this hard :)
2 comments
I suggest you to check my answer :)
I know you don't want to sound like a begger, but most of these answers are on the wiki.... like random numners etc. Please read the wiki if you can.