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.

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)
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

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

Answer this question