im trying to stop the idle animation from playing but i keep getting this error message:
21:11:05.776 Players.TheBossOfBancon.Backpack.pitchfork.servertool:10: attempt to index nil with ‘Stop’ - Server - servertool:10
local tool = script.Parent
local idle = nil
local idle = tool.Parent.Humanoid.Animator:LoadAnimation(script:WaitForChild("idle"))
local cooldown = 5
local lastActivation = 0
if part.Name == "Handle" then
local player = game.Players:GetPlayerFromCharacter(tool.Parent)
local currentTime = tick()
if currentTime - lastActivation >= cooldown then
local use = tool.Parent:FindFirstChild("Humanoid"):LoadAnimation(script.use)
player.leaderstats.Cash.Value += 5
lastActivation = currentTime
Instead of this:
Use this. It’s better because you don’t have to load the animation each time. It should also fix your error.
local animation = script:WaitForChild("idle")
local character = tool.Parent
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local idle = animator:LoadAnimation(animation)
i got this error:Infinite yield possible on ‘Players.TheBossOfBancon.Backpack:WaitForChild(“Humanoid”)’
Ah, well, that’s because, ‘tool.parent’ is the backpack, so it doesn’t work. Instead of this line:
use this line:
local character = tool.Parent.Parent.Character
This will only work if the tool is parented to the backpack when the player spawns.
its is really confusing i got another error: 21:47:41.258 Cannot load the AnimationClipProvider Service. - Server - servertool:6
This is a very annoying error that has occurred several times before. It occurs when you try to load an animation before the character is loaded.
Here’s a fix for it:
local character = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name)
Basically, this will wait for the character to load into the world.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.