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

Animation not running becaues i dont know how it is suppost to run?

Just trying to make the animation run to lunge when you click down on the tool. I haven't used animations so I am clueless to how I am suppose to accomplish this.

local tool = script.Parent.Parent


tool.Equipped:connect(function(equip)
		script.Parent.Sound1:Play()
	equip.Button1Down:connect(function()
		tool.swordswingjump:LoadAnimation()

	
	
	
	
	end)
end)

1 answer

✓ Accepted answer

To play an animation on a player, you must load the animation from the Humanoid object of the Player's character. This will return an object of class "AnimationTrack". You then call the Play method of that AnimationTrack.

local player = game.Players.LocalPlayer
local character = player.Character

if character then
	local humanoid = character:findFirstChild("Humanoid")
	
	if humanoid then
		local animationTrack = humanoid:LoadAnimation(tool.swordswingjump)
		
		animationTrack:Play()
	end
end

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