Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

01local Player = game.Players.LocalPlayer
02 
03Character = script.Parent
04 
05local Mouse = Player:GetMouse()
06 
07Mouse.Button1Down:connect(function(Punch) --it works--
08    local Punch1 = script:FindFirstChild("Punch1")
09    Punch1.AnimationId = "rbxassetid://5436382797"
10    local Humanoid = Character:FindFirstChild("Humanoid").LoadAnimation
11    if Humanoid then
12        local AnimationTrack = Punch:LoadAnimation() --there is the problem --
13        AnimationTrack:Play()
14        return AnimationTrack
15    end
16end)
1
I dont think you need the if humanoid statement, also, where is the local script located? mcslimeman 37 — 4y
0
This local script is the children of an Player.Character BryanDarielGamer 1 — 4y

1 answer

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
4 years ago

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

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

Answer this question