#Animation Won’t Play on Server Despite Proper Setup in Script

1 messages · Page 1 of 1 (latest)

inland shale
#

Hey everyone, I’m following a tutorial on making a click-based attack system in Roblox Studio. I set up everything on the server-side, including loading and playing the animation via Humanoid.Animator:LoadAnimation(), but for some reason, the animation doesn’t play at all when I click. Here's my script.

`local ReplicatedStorage = game.GetService("ReplicatedStorage")
local Players = game.GetService("Players")

local Events = ReplicatedStorage.Events

local AttackHitboxes = require(script.Parent.AttackHitboxes)

local ClickAttackDebounces = {}

Events.ClickAttack.OnServerEvent:Connect(function(Player)
local Character = Player.Character
if Character == nil then
return
end
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid == nil then
return
end
if Humanoid.Health <= 0 then
return
end
if ClickAttackDebounces[Player] then
return
end

ClickAttackDebounces[Player] = true
local PunchCombo = Player.Value.PunchCombo
local Animation = script.PunchAnimationCycles[tostring(PunchCombo.Value)]
local LoadedPunchAnimation = Humanoid.Animator:LoadAnimation(Animation)
LoadedPunchAnimation:Play()

if PunchCombo.Value >= #script.PunchAnimationCycles:GetChildren() then
    PunchCombo.Value = 1
else
    PunchCombo.Value +=1
end

task.wait(LoadedPunchAnimation.Length + 0.1) 

if ClickAttackDebounces[Player] then
    ClickAttackDebounces[Player] =  nil
end

end)`

solemn tinsel
#

u have to upload the animation to the group or export it