Animations not playing

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

1 Like

Is there anything being sent in the output? If so could you please send what it says?
Your script is a little difficult to read as you did not put all of it in a code block.

1 Like

Hello, no error is being sent in the output. I also added debug prints after the animation function, in the animation function and both print, however the animations don’t play. I’m not sure about how the script got this format, probably because of the keywords. I’ll try to paste it here

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)

2 Likes

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)

1 Like

Does your game have permission to use the animations?

2 Likes

It should. I upload the animations under my name and I even double check to make sure it has permissions

1 Like

Found the error. The game forced R15, and my animation was R6.

Where do you find that force the R15 ?

I have the exact same bug, i do all perfectly, and NOTHING works
But other animation from player works as well

New Avatar Settings page, press the 3 dots at the top right and set it to R6 Only. If you don’t game appears to look like R6 but it’s really just R15 with R6-like animations.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.