What do you want to achieve?
Animation replication on server and client using a local script.
What is the issue? Include screenshots / videos if possible!
Following the Roblox API and loading the animation in a descendant of the humanoid or the animator itself should replicate the animation, but it does not work.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried creating a new animation instance with the animation Id,
I’ve tried using the deprecated “humanoid:LoadAnimation()” which in previous scripts has replicated to the server but in this instance it has not.
I’ve tried moving the animation to the character before loading it to check if that would make any difference but it still doesn’t replicate.
local humanoid = character:FindFirstChild("Humanoid")
script.Animation.Parent = humanoid.Animator
animationtrack = humanoid.Animator:LoadAnimation(humanoid.Animator.Animation)
anim_playing = false
run_service:BindToRenderStep("anim",200,function(dt)
if not anim_playing then
anim_playing = true
animationtrack:Play(0,999,1)
task.wait(animationtrack.Length)
anim_playing =false
end
end)
-- note this is just a test block of code to try and get it to work, i know its not pretty and its not efficient but i just want it to work first.
Example of working block in previous script (it doesnt work when trying in new script)
if Humanoid then
for i,v in Animations do
if type(v) == "number" then
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://"..v
local loaded = Humanoid:LoadAnimation(anim)
LoadedAnims[i] = loaded
--
end
end
end
I’ve put your script into a LocalScript and parented that at StarterCharacterScripts.
Location of the Animation should not and matter, could be located to nil and would still work.
It might also be to due to using your locally uploaded animation (to your account) in your group.
All the animations you want to use inside your group should be uploaded as group animations.
And even if they where to be local animations on group owned games i found it to still function in studio, and it doesn’t apply to this scenario since its in a game owned by my account and locally uploaded from the animation editor.
Is your AnimationPriority in the uploaded animation over the default Idle and Movement states?
For it to be properly shown over default movement Animations it should be at least Action.
You can set it in animation editor or using script too afaik.
Its not a problem of whether its playing over default animations, but a problem of it not replicating to the severer. Does it depend on location of the script loading the animation? If so that would make a lot of sense although the documentation on this only states
From: Animation | Documentation - Roblox Creator Hub
Which doesn’t include anything on the location of the script loading the animation onto the Animator itself, which would clear up a lot of confusion.
Also unrelated question, how do you get the loaded animations to appear like that on the screen?
I answered my own question and tested out putting a script like that in character scripts, and it still wouldn’t replicate to the server, as well as re-uploading as an action.
Animations played from client should always replicate to server.
Unless player doesn’t have ownership of their own character.
That can happen with custom rigs sometimes, doubt that’s the issue here.
I had a few cases like that when they didn’t replicate to server, uploaded to the group I worked for.
As far as I recall, that animation eventually worked? We re-uploaded it, didn’t work in studio, worked on public servers. We’re in the blindness on this one, as you are doing everything correct script-wise.
File > Studio Settings… > Network > Appearance : Show Active Animation Asset
Thank you so much for your help, I changed a few things around and got the script working;
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://76355303826530"
local humanoid = script.Parent:FindFirstChild("Humanoid")
animator = humanoid:FindFirstChildOfClass("Animator")
animationtrack = humanoid.Animator:LoadAnimation(anim)
anim_playing = false
game:GetService("RunService"):BindToRenderStep("anim",200,function(dt)
if not anim_playing then
anim_playing = true
animationtrack:Play(0,999,0)
task.wait(animationtrack.Length)
anim_playing =false
end
end)
I’m unsure exactly as to what’s different but now it replicates on both ends. And thanks for answering my question about displaying animations. Perhaps it was reuploading the animation to action priority as well and it taking time to refresh being what fixed it. Have a good morning or evening.
Neverminded it still doesn’t work?? I changed the animation speed from 0 to 1 and it went back to what it was
The method I was using apparently didnt replicate well, instead of using the runservice to play every time it finished, just use animationtrack.looped = true and it should be fine.