I uploaded some animations to my inventory by saving the keyframe sequences (I got from the toolbox) to roblox, I have made some code to play this running animation only when the player moves.
The script is a local script in startercharacterscripts.
task.wait(3)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Animation = script:WaitForChild("Animation")
local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Movement
AnimationTrack:Play()
I have tried changing the priority to Action4, the most prioritized animation action. Yet that hasn’t worked.
Also tried adjusting the weight, even to 100. The animation still isn’t seen.
There are no errors in the output and when I check if the animation is playing through the track.IsPlaying boolean it returns true.
This is where I got the animations from, try this yourselves on your side and see if you have the same issue. Maybe it’s the model itself:
Make sure that the game creator and animation uploader is the same person. I mean, if you’are making game on group the animation should be uploaded from group.
I think the problem is that your AnimationTrack doesnt know what is the id of your Animation even tho you added the variable for the animation. So what i would do is before loading the animation track do something like this:
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://123" -- Your id
Animation:Destroy()
task.wait(3)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://18640784305"
local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack.Priority = Enum.AnimationPriority.Movement
AnimationTrack:AdjustWeight(100)
print(AnimationTrack.WeightTarget)
AnimationTrack:Play()
By the way I keep seeing people doing "Instance.new(“Animation”) but wouldn’t this take up resources unneccessarily because each time the character is added a new animation object will be made but the previous one will still be there?
Nah it’s just a movement animation, I assumed that just setting the animation priority to movement would mean that the track would play whenever the player moves.
So I parented it to startercharacterscripts and it runs after like 3 seconds just to make sure stuff is loaded in incase that was ever a problem.
So i dont think you know this but you can get the roblox movement animations script by playing the game in studio going to your character model and searching for the animate script copy it then paste it and modify the animations with yours in the string values in the script.