✓ Accepted answer
Equipped is an event. You can't compare Equipped (which is RBXScriptSignal) to a boolean value. Instead, connect it to a function so that when the event fires, the function is ran. You can connect an event to a function by using the Connect method in a RBXScriptSignal. Remember that you also can't play an animation if it's built on R15 and you're using an R6 rig.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character:WaitForChild("Humanoid")
local tool = script.Parent
local animation = tool.Animation
local track = humanoid:LoadAnimation(animation)
tool.Equipped:Connect(function()
wait(0.1)
track:Play()
end)
tool.Unequipped:Connect(function()
track:Stop()
end)
I tried to be descriptive on what was happening. It's good practice to use lots of descriptive variables. Good luck!
4 comments
Equipped is an event, not a boolean
Sorry, I did not know that. Please tell me what I can do.
Are you askng, like how to make a equip animation script? Like the way you hold the tool? or what? And also, as theking said, Equipped is an event.
ChefDev, what I mean is when I take out the tool it plays an animation.