Hello, so I’ve made a very simple script to play a looped animation when the tool is equipped.
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=5215451472" --replace with id
local track
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = true
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
For some reason, the animation plays looped on the client but shows only one time on the server.
And when I try to do the same script in a script and not a local script, the opposite happens, the server is looped but for the client the animation isn’t looped.
I’ve tested it with some friends, here are some video examples:
You’re playing the animation the client-side that’s why, if you wish to make the animations appear for everyone, you can either play the animation on the server, or use a AnimationController which makes animation replicate if played on the client.
If an Animator is a descendant of a Humanoid or AnimationController in a Player’s Character then animations started on that Player’s client will be replicated to the server and other clients.
In his case, it was loaded in the humanoid. LoadAnimation creates an Animator object.
There is a bug with setting the Looped property via script rather than in the Animation editor.
To avoid this you can change the property in the animation editor, and then publish the animation.
When switching to the server view, you can see that the animation is playing for a second before stopping, suggesting that the looped property itself isn’t replicated across the boundary.