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

(Solved) Why my punch animation doesn't play?

When I press left click, the game detect it, but doesn't play it. This is my first animation, plis, help me.

local Player = game.Players.LocalPlayer

Character = script.Parent

local Mouse = Player:GetMouse()

Mouse.Button1Down:connect(function(Punch) --it works--
	local Punch1 = script:FindFirstChild("Punch1") 
	Punch1.AnimationId = "rbxassetid://5436382797"
	local Humanoid = Character:FindFirstChild("Humanoid").LoadAnimation
	if Humanoid then
		local AnimationTrack = Punch:LoadAnimation() --there is the problem --
		AnimationTrack:Play()
		return AnimationTrack
	end
end)

2 comments

1

I dont think you need the if humanoid statement, also, where is the local script located?

0

This local script is the children of an Player.Character

1 answer

You'll need to load the animation in a humanoid. Lets say there's a Dummy in the workspace, and an animation in the workspace too

local Animation = workspace.Dummy.Humanoid:LoadAnimation(workspace.Animation)
Animation:Play()

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