I want to make a script that plays a punch animation when M1 is clicked and fires a remote event, this is what i have but for some reason the animation is not playing when the button is pressed. I do own the animation and there are no errors
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local event = game.ReplicatedStorage:WaitForChild("Punch")
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local AnimationId = 6214482685
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://"..AnimationId
local AnimationTrack = Humanoid:LoadAnimation(Animation)
local function Punch()
if not (AnimationTrack.Stopped) then return end
event:FireServer()
AnimationTrack:Play()
end
Mouse.Button1Down:Connect(Punch)
