#Animation problem

1 messages · Page 1 of 1 (latest)

waxen oak
#

``lua
local RS = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local events = RS:WaitForChild("Events")
local startComboAnimation = events:WaitForChild("StartComboAnimation")

local M1s = RS:WaitForChild("M1s")

local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = hum
end

local function playAnimation(state)
if not state then
warn("State is nil!")
return
end

for _, anim in pairs(M1s:GetChildren()) do
    if anim:IsA("Animation") and anim.Name == "M1("..state..")" then
        
        local track = animator:LoadAnimation(anim)
        track:Play()
        print("Playing animation:", anim.Name)
    end
end

end

startComboAnimation.OnClientEvent:Connect(function(state)
playAnimation(state)
end)

``

this is my code and i don't know why it's not plaing the animation

grave vigil
#

is ur remoteEvent firing?

shell ivy
#

any errors?

cloud sapphire
waxen oak
#

it's not chatgpt first and there is no error but for some reasons animation isn't playing

uneven dune
#

id is wrong