You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make the rig to play an animation (attack).
-
What is the issue? The animation doesn’t play at all.
-
What solutions have you tried so far? I’ve looked for solutions in the Developer Forum but didn’t find any.
local bossTool = bossModel:WaitForChild(BossInData:FindFirstChild("SwordNameValue").Value)
local Humanoid = bossModel:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local AttackAnimationID = 16421461996
local AttackAnimation
if not Humanoid:FindFirstChildOfClass("Animation") then
AttackAnimation = Instance.new("Animation", Humanoid)
AttackAnimation.Name = "AttackAnimation"
AttackAnimation.AnimationId = "rbxassetid://" .. AttackAnimationID
end
AttackAnimation = Humanoid:FindFirstChildOfClass("Animation")
local AttackAnimationTrack = Animator:LoadAnimation(AttackAnimation)
local previousActivationTime = 0
local cooldown = false
while wait(1.2) do
if AttackAnimationTrack and not cooldown then
local currentTime = tick()
local timeDifference = currentTime - previousActivationTime
local speedIncrement = 3.2
local totalSpeed = speedIncrement + (1 / (timeDifference + 0.1))
print(totalSpeed)
AttackAnimationTrack:Play(0.1, 1, totalSpeed)
cooldown = true
previousActivationTime = currentTime
end
AttackAnimationTrack.Stopped:Wait()
cooldown = false
end
It’s in Server side btw