As I’ve taken a big break from scripting, I have gotten a little bit rusty.
Basically, my walk animation and my knife animation isn’t playing at all. I’ve tried countless fixes for this and I’ve scowered all over the internet but to no avail. I am absolutely clueless to what’s going on and I would like some help on this.
Local script for walking animation(Yes, I have 2 scripts as I’ve done it on both client and server to see if it works)
This local script is located in StarterCharacterScripts
local char = game.Players.LocalPlayer.Character
local animate = char:WaitForChild("Animate")
animate.run.RunAnim.AnimationId = "rbxassetid://10498720243"
animate.walk.WalkAnim.AnimationId = "rbxassetid://10498720243"
Server Script(aka. my second attempt into getting a working walk animation)
This server script is located in Server Script Service
local Animation = Instance.new("Animation")
Animation.AnimationId = "Your animation here"
local asdf = Animator:loadAnimation(Animation)
asdf:Play()```
this is what I use, sorry this isn't much help I'm a bit rusty too
I would personally reference the animation and character out of the Tool.Activated function. I would also put the animation under the script. It would look somewhat like this:
local char = game:GetService("Players").LocalPlayer.Character
local animator = char:WaitForChild("Humanoid"):WaitForChild("Animator")
local animation = animator:LoadAnimation(script.Animation) -- REMEMBER TO PUT ANIMATION UNDER SCRIPT
script.Parent.Activated:Connect(function()
animation:Play()
task.wait(0.15)
animation:Stop()
end)
this probably won’t fix it, but it would be a lot cleaner. If it still doesn’t work see if it returns any errors and reply to this, thanks.
This should fix the error, the localscript ran before the character was loaded into workspace.
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character -- Waits until the character has loaded into workspace.
local character = plr.Character
print("b")
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
print("no")
local Animation = Instance.new("Animation")
script.Parent.Activated:Connect(function()
print("a")
Animation.AnimationId = "rbxassetid://10498835413"
Animation.Parent = script
local loadanimation = animator:LoadAnimation(Animation)
local load = animator:loadAnimation(Animation)
loadanimation:Play()
print("worked")
end)
It is because you loaded a new 2nd animation to the humanoid, where the first one wouldn’t work.
I just tested with one my animations and it worked.
This is the working code, I removed line 14 which was local load = animator:loadAnimation(Animation)
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character -- Waits until the character has loaded into workspace.
local character = plr.Character
print("b")
local animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
print("no")
local Animation = Instance.new("Animation")
script.Parent.Activated:Connect(function()
print("a")
Animation.AnimationId = "rbxassetid://10498835413"
Animation.Parent = script
local loadedAnimation = animator:LoadAnimation(Animation)
loadedAnimation:Play()
print("worked")
end)
I haven’t overridden it(since I don’t know how to) but I have created an entirely new animation and changed the script to have the new animations id. No luck still. Maybe its only playing on the server? But I’m using a local script.
Could you send the animation in a .rbxm file so I could look at it too see if I can find a issue in the animation itself? If not I could try and create a tool animation in R6/R15.