What do you want to achieve?
How do i make idle animation plays if the player is idle when equipping sword only?
What is the issue?
Idle animation still plays when player moves with the sword equipped
(Sorry i forgot to put the vid)
What solutions have you tried so far?
i tried searching yt and other social media but seems like i couldn’t find any
btw heres the code
local player = game.Players.LocalPlayer
repeat wait(1) until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animation = script.Animation
local animtrack = humanoid:LoadAnimation(animation)
script.Parent.Equipped:connect(function()
animtrack:Play() -- Plays Idle Animation
end)
script.Parent.Unequipped:connect(function()
animtrack:Stop() -- Stops Idle Animation
end)
How i would achieve this is changing the code for the character animation script. i would run childadded and childremoved on the character and if child:IsA “Tool” then apply that tools specific animation. you can achieve this by creating a startercharacter and putting it in starterplayer and then editing the animtion code. make sure to load player appearance on char too and it will be the same
That isn’t the issue. If there was any issue with the animation then it would be .Looped being off. If hes playing an idle animation then im assuming nothing else is playing when it runs on equipped. Meaning its either not .Looped or it isn’t playing cause of the Animations script. Which is why i proposed my method which would allow him to set up multiple tools in the future without the need of having a script inside every single tool and making it very easy to edit
Yes thats why i said to edit the animation script code. Since you would only be changing the animation id. All you would be doing is changing the idle to the new idle. And when they unequip revert to the default. You wouldnt need to code anything else. But if you really don’t want to do that then you’re going to need to add
Humanoid.Running:connect(myFunc)
What this will do is call myFunc everytime your characters speed changes.
The link below shows how you would use this to determine if their speed is currently 0 or not. All you need to do is make your Idle animation not run if speed > 0
This does work. Are you sure your animation is set to a priority higher than Core?
I have several games actively using this sort of interpretation and I’ve yet to come across the walk animation “breaking”