Animation not work on client

Hi, i have problem, i try to play animation on client, with Animator with animation controller, but the animation don’t shows, it’s published under the group and i have no clue what happened, here is script

local remote = game:GetService(“ReplicatedStorage”):WaitForChild(“Remote”):WaitForChild(“Events”):FindFirstChild(“ReplicateAnimation”)

remote.OnClientEvent:Connect(function(model:Model,animation:Animation)

local controller = model:FindFirstChildWhichIsA(“AnimationController”)
if controller then
local Animator = controller:FindFirstChild(“Animator”)
local track = model.Humanoid:LoadAnimation(animation)

  track:Play()

end

end)
animations are loaded on start of game from module on server in replicated storage, then the event fire this function

1 Like

firstly your track should be loaded to animator

2 Likes

Probably because controller doesn’t exist for some reason, or the event is never triggered. Try this and see if it works when you instantiate an animation object yourself and also check if it prints:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")


local remote = game:GetService(“ReplicatedStorage”):WaitForChild(“Remote”):WaitForChild(“Events”):FindFirstChild(“ReplicateAnimation”)

remote.OnClientEvent:Connect(function(model:Model,animation:Animation)
    print("YES")
    local animation = Instance.new("Animation")
    animation.AnimationId = "http://www.roblox.com/asset/?id=YOUR_ID" 

    local track = humanoid:LoadAnimation(animation)
    track:Play()
end)

1 Like

soo it works, but the animation don’t play on character, even i can print track that is loaded, but track:play() makes nothing

and i preload animations, first module reads id’s from table for different things like mobs, weapons ect… then it makes new animations on server in replicated storage.

Ok it worked if i used humanoid instead of animation controller

That’s what I did in my reply. Aren’t you supposed to mark that as solution instead?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.