I made my priority movement and loop but is still not working and is a basic script I need help to fix this and I don’t really know why and what is even wrong with it.
Hello there,
Maybe your script is not working because the the “humanoid” isnt actually the humanoid. If the gear is in starter pack it will spawn in the backpack so you should instead get the character first, then use that to access the humanoid
One other thing COULD be how you are getting your animation. Roblox documentations are very helpful for this
Id love to help with additional questions and hope this helps you
If it is a local script. Just do this
local ps = game:GetService("Players")
local plr = ps.LocalPlayer
local character = plr.Character
local Humanoid = character:FindFirstChildOfClass("Humanoid")
local katana = script.Parent
katana.Equipped:Connect(function()
if Humanoid.WalkSpeed >= then
Humanoid:FindFirstChildOfClass("Animator"):LoadAnimation(katana.Run):Play()
end
end)
Is a server script so I need to find out how would I fix this in a normal server script but thank you for that local script method
Once i get on a PC again i can help you out better
But for now you can get the character with
local character = Katana.Parent
local humanoid = if character then character:FindFirstChildOfClass(“Humanoid”) else nil
Also be sure to check the roblox docs on animations, it helped me a lot in the past
Isn’t script.parent.parent:FindFirstChild(“Humanoid”) the same thing?
Try using a remote event
When the tool is equipped fire the event and do all that.
Well the tool is actually in the backpack so that could be why its not working
But when you equip the item won’t it go out of the backpack?
You’re right, this could work too
Right, but the parent still wouldnt be the humanoid, its the character itself
But I been doing the same method with my idle server script and my slash server script
Hmmm, my guess is its something to do with the animation then
like the Animaton priority?
You mean?
No, i mean it could be to do with the script actually playing the animation. You need to get the animator from the humanoid
Check the roblox docs on animations, it should help
To save you some headache, get your humanoid inside your equipped variable:
local katana = script.Parent
katana.Equipped:Connect(function()
local humanoid = katana.Parent:FindFirstChildOfClass("Humanoid")
if humanoid ~= nil then
local anim = humanoid:LoadAnimation(katana.Run)
anim:Play()
katana.Unequipped:Once(function()
anim:Stop()
anim:Destroy()
end)
end
end)
If I done this with local script would other player see the animation to?
No, keep it on the server side for sure
This kinda work but when I unequip the Run animation is still running