local remotes = rp:WaitForChild("Remotes")
local combatRemote = remotes:WaitForChild("Combat")
local animations = rp:WaitForChild("Animations")
local combatAnims = animations:WaitForChild("Combat")
local Players = game:GetService("Players")
local max_combo = 5
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char:SetAttribute("Combo",0)
end)
end)
local function changeCombo(char)
local combo = char:GetAttribute("Combo")
if combo < max_combo then
char:SetAttribute("Combo", combo + 1)
else
char:SetAttribute("Combo", 1)
end
end
local function getAnimation(char)
local combo = char:GetAttribute("Combo")
local anims = combatAnims:GetChildren()
local currAnim = anims[combo]
return currAnim
end
combatRemote.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local humRp = char:WaitForChild("HumanoidRootPart")
local animator = hum:FindFirstChildOfClass("Animator") or Instance.new("Animator",hum)
local attacking = char:GetAttribute("Attacking")
local slicing = char:GetAttribute("Slicing")
if attacking or slicing then return end
char:SetAttribute("Attacking", true)
char:SetAttribute("Slicing", true)
changeCombo(char)
local sliceAnim = getAnimation(char)
local playAnimation = animator:LoadAnimation(sliceAnim)
playAnimation.KeyframeReached:Connect(function(kf)
if kf == "hit" then
task.wait(0.21)
char:SetAttribute("Attacking", false)
if char:GetAttribute("Combo") == max_combo then
task.wait(1.5)
end
char:SetAttribute("Slicing", false)
end
end)
playAnimation:Play()
end)```
#Why does the anim loop when I click?
20 messages · Page 1 of 1 (latest)
.Looped property is enabled or you uploaded the animation looped.
I don't even need to read code to answer this
thanks
okay, will do
** You are now Level 1! **
Trust me you don't want to end up like him
#1247251937938636951 message
jeez
I know what I'm talking about 😭
so do modules basically save time
Yes, they give flexibility and autocomplete to functions that you may create in different scripts.
i see