Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

:Play() is not a valid member of animation?

I need help please. Why does it say Play is not a valid member of animation

local plr = game.Players.LocalPlayer
repeat wait()until plr.Character
local humanoid = plr.Character:WaitForChild("Humanoid")


local tool = script.Parent
local NilAnim = script.Nil
local FiringWeaponAnim = script.FiringWeapon
local EquippedWeaponAnim = script.EquippedWeapon

script.Parent.Equipped:Connect(function()
	humanoid:LoadAnimation(EquippedWeaponAnim)
	EquippedWeaponAnim:Play()
	script.Parent.Unequipped:Connect(function()
		print("Unequipped")
	end)
end)

1 comment

1 answer

✓ Accepted answer

You need to save the variable of the loaded animation track like so

script.Parent.Equipped:Connect(function()
    local anim = humanoid:LoadAnimation(EquippedWeaponAnim)
    anim:Play()
    script.Parent.Unequipped:Connect(function()
        print("Unequipped")
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.