Add under the katana.Unequipped function
Anim:Stop()
Add under the katana.Unequipped function
Anim:Stop()
Yea I can see that makes more sense
Yes? Players see animations casted on the clientside too.
Doing animations on serverside and clientside doesn’t change a thing about them.
I think is solved thank you so much but still doesn’t work when I add the if statement if walk speed more then 10 the run animation play instead just go contious like if it replace my idle animation
Oh, sorry. I didnt know that! I didnt mean to spread misinformation
It’s all cool bro don’t stress about it
I try to add the if statement in it but is still not working and is still making the run animation even when is less then 10
If you are manipulating WalkSpeed
in the client, the server won’t see the changes. You can either change this into a LocalScript
or manipulate the WalkSpeed
in the server instead.
Also, put the Unequipped
connection inside your if humanoid.WalkSpeed >= 10
scope or else it will throw an error since anim
might not exist when calling anim:Stop()
.
I tried it on server and local and I still achieve the same problem the run animation is still running even when walk speed is less then 10
So, what exactly is happening? no errors in the output, right? also could you post your current script, if you dont mind, because i’m on my PC right now and i want to try to help you
Also there is no errors in output
Try moving katana.Unequipped
outside of the katana.Equipped
connection.
Is still not working is still showing the running animation even when walkspeed is less then 10
Oh, I see. Currently, you’re checking the walkspeed when the tool is equipped, not while its equipped. You need to constantly check if the player’s walkspeed is less than 10. Try something like this:
repeat
task.wait()
until not katana.Equipped
Ah yes that what I was doing wrong I realise this I experience it before it ain’t going to detect contiously so if I use repeat and put the if statement inside It prob detect contiously aswell let me actually try that
Unfortunately when I tried this instead of fixing the problem it just make the run animation play multiple time even if it was less then 10 it either I script this wrong or Is just a wrong solution to use a repeat loop but I know they can be efficient so is hard to tell so Ima send this script for you to tell me if it is right or wrong
wait, i think i got something:
try anim = humanoid:LoadAnimation(katana.Animation)
anim:Play()
else
anim:Stop()
Yes = humanoid:LoadAnimation(katana.Animation)
Yes:Play()
this is because you already have the humanoid defined, so no need to put all of it over again
also maybe try using the humanoids animator to define the animations
Roblox Animation Documentation: Anim docs
Theres a function on humanoid called Running heres a little coding soo u can understand it!
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
local lighting = game:GetService("Lighting")
hum.Running:Connect(function()
lighting.ClockTime += 0.1
end)
your script needs to be a local script