I have a script that plays a custom holding animation when equipped, works how I want in playtest, literally nothing wrong while playtesting but when I play the game it doesn't work. I went to the console while in-game and it says the player doesn't have a humanoid or something?

btw this game wasn't made on a group so its not that i uploaded the animation to my profile but the game was made by a group

local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")

local Animation = Humanoid:LoadAnimation(script.Animation)

script.Parent.Equipped:Connect(function()
	Animation:Play()
end)
script.Parent.Unequipped:Connect(function()
	Animation:Stop()
end)

2 comments

1

try doing :WaitForChild() instead of :FindFirstChild() when setting the humanoid variable

0

THANK YOU!