Doesn’t seem to play at all, confused about this.
Try messing around the the Priorities.
Did/done that already, tried messing with the Id area, locations, and the functions. nothing’s working.
Have you made sure your avatar is the exact same rig as your player? Like both are r6 or r15
Yes, infact here. This is my sprint script where if the player actually runs, it’ll play the animation perfectly. I want this to be modified so if the player equips the tool and begins to walk, they get the speed and the walk animation plays. (Speed coil.)
local UIS = game:GetService(‘UserInputService’)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Anim = Instance.new(‘Animation’)
Anim.AnimationId = ‘rbxassetid://10478382029’ – Change the ID to your own Animation, Otherwise put 0 for no Animation.
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
local keyDown = false
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
keyDown = true
local animPlying = false
while keyDown == true do
wait(0.01)
if Character.Humanoid.MoveDirection.Magnitude > 0 and keyDown == true then
Character.Humanoid.WalkSpeed = 23 -- Change this to the running speed.
if animPlying == false then
animPlying = true
PlayAnim:Play()
end
elseif Character.Humanoid.MoveDirection.Magnitude <= 0 and keyDown == true then
Character.Humanoid.WalkSpeed = 23 -- Change this one too.
if animPlying == true then
animPlying = false
PlayAnim:Stop()
end
end
end
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
keyDown = false
Character.Humanoid.WalkSpeed = 16
PlayAnim:Stop()
end
end)
I don’t even know where to begin to modify it so it works with an “when equipped” instead of “key pressed”
local tool = script.Parent
local animation = tool:WaitForChild("Animation")
local player = game.Players.LocalPlayer
local char = player.Character
local loadAnimation = char.Humanoid:LoadAnimation(animation)
tool.Equipped:Connect(function()
loadAnimation:Play()
end)
This worked for me so if it doesn’t work for you I’m not too sure man
Remember to set the Animation Priorities and have a handle.
How would I make it play only if the player moves? (Found a script that plays the animation when equipped, but always playing)
local tool = script.Parent
local anim = Instance.new(“Animation”)
local anim1 = Instance.new(“Animation”)
anim.Name = “IdleAnim”
anim.AnimationId = “rbxassetid://0” – Idle Animaton ID
anim1.Name = “WalkAnim”
anim1.AnimationId = “rbxassetid://10478382029”-- Equip Tool Animaton ID
local track
local track1
– When Tool Equipped
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track1 = script.Parent.Parent.Humanoid:LoadAnimation(anim1)
track.Priority = Enum.AnimationPriority.Movement
track1.Priority = Enum.AnimationPriority.Movement
track.Looped = true
track:Play()
track1:Play()
end)
– When Tool UnEqiopped
tool.Unequipped:Connect(function()
if track and track1 then
track:Stop()
track1:Stop()
end
end)
You can use something like
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local walkAnim = script:WaitForChild("Animation")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)
humanoid.Running:Connect(function(speed)
if speed > 0 then
if not walkAnimTrack.IsPlaying then
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)
This just goes into a tool right?
And then implement this script into your tool script so it’d maybe look like
tool.Equipped:Connect(function()
humanoid.Running:Connect(function(speed)
if speed > 0 then
if not walkAnimTrack.IsPlaying then
walkAnimTrack:Play()
end
else
if walkAnimTrack.IsPlaying then
walkAnimTrack:Stop()
end
end
end)
end)
Little confused on where I would put the walkAnimTrack.
i wanna give up man, this si so difficult and i cant figure it out.
Oh crap I’m so sorry. local character
should be local character = game.Players.LocalPlayer.Character
I managed to achieve a run animation change by adjusting the roblox animation script following this post:
I adjusted mine so that it can play for R6, but if your game is R15 just copy from the thread I attached.
Heres a download so you can get a look at it:
RunningItemExample.rbxl (41.7 KB)
I’ve figured it out. For those who have the same problem as me, here’s the script.
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")
local Animation = Humanoid:LoadAnimation(script.Animation)
tool = script.Parent
tool.Equipped:Connect(function()
game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid:// your running id"
Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end)
tool.Unequipped:Connect(function()
game.Players.LocalPlayer.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid:// put your normal walking id" --default id
Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end)
Insert a Animation into the local script and put this into the tool.
literally the one and only true solution on whole google
Here is THE solution after hours of searching how to solve this with a sprint system w/ animations