I’m currently following a series, and I got to the point where I added animations for the punches.
local Debris = game:GetService(“Debris”)
local Players = game:GetService(“Players”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local UserInputService = game:GetService(“UserInputService”)
local HitboxModule = require(ReplicatedStorage:WaitForChild(“Modules”):WaitForChild(“HitboxModule”))
local getCharacterInfo = ReplicatedStorage:WaitForChild(“Remotes”):WaitForChild(“getCharacterInfo”)
local animPrefix = “rbxassetid://”
local data = {
punch = {
ondebounce = false,
debounceTime = .3,
onNum = 1,
maxNum = 4,
animations = {
[1] = "80132727877793",
[2] = "91468883894338",
[3] = "96450281750035",
[4] = "97360422149025",
},
},
}
local player = Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild(“Humanoid”)
local animator = hum:WaitForChild(“Animator”)
local function playAnim(Id)
local animId = animPrefix..Id
local animation = Instance.new("Animation")
animation.AnimationId = animId
local animTrack = animator:LoadAnimation(animation)
animTrack:Play()
end
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local selectedChar, charDataTable = getCharacterInfo:InvokeServer()
if selectedChar and charDataTable and data.punch.ondebounce ~= true then
data.punch.ondebounce = true
if data.punch.onNum + 1 > data.punch.maxNum then
data.punch.onNum = 1
else
data.punch.onNum += 1
end
playAnim(data.punch.animations[data.punch.onNum])
local hitbox = HitboxModule.CreateHitbox(player, "Block", Vector3.new(5,5,5))
Debris:AddItem(hitbox, .1)
hitbox.Touched:Connect(function(hit)
print("hit")
end)
task.wait(data.punch.debounceTime)
data.punch.ondebounce = false
end
end
-- // dash
-- // abilities
end)
My animations are not playing AT ALL;
I set the priority to action; I made the game force R6; I uploaded the animations correctly; I tried it with other test animations and it still didn’t play;
Can someone help