Character not playing animation (No errors showing)

I am following this youtube tutorial: Roblox Sword Combat Tutorial Part 1 - YouTube
and is at around the 15 minutes section, however, the animation is not playing like it is in the video.

here is the script:

---import animation here---
local swingAnims = {
	'rbxassetid://10361309646',
	'rbxassetid://10361362203',
	'rbxassetid://10361390995',
	'rbxassetid://10361426144',
	'rbxassetid://10361455455'
	}
---setup---
local t = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")

local resource = rs.Combat.Sword
local fx = resource.Fx
local remote = rs.Remotes.Combat

local p = game.Players.LocalPlayer
local c = script.Parent
local hrp = c.HumanoidRootPart
local combo = 1
local lasthit = 0
local cd = false

local anim = script:WaitForChild("Animation")

local function setUp(char)
	local handle = fx.Handle:Clone()
	handle.Parent = char
	local m6d = Instance.new("Motor6D", handle)
	m6d.Part0 = char.RightHand --Replace with .RightArm if using R6
	m6d.Part1 = handle
	m6d.C1 = CFrame.new(0,0,0) -- Handle Offset
	local model = fx.Sword:Clone()
	model.Parent = workspace.Fx
	local weld = Instance.new("Weld", model)
	weld.Part0 = handle
	weld.Part1 = model
	weld.C1 = CFrame.new(3,0,0) * CFrame.Angles(math.rad(90),math.rad(90),0) --Sword Offset + Rotation
end

for i,v in pairs(game.Players:GetChildren()) do
	repeat wait() until v.Character
	setUp(v.Character) --Setup upon joining
	v.CharacterAdded:Connect(function(char)
		char:WaitForChild("RightHand") --Replace with "RightArm" if using R6
		setUp(char) --Setup upon respawn
	end)
end

local function slash(char, comboN)
	
end

uis.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.UserInputType == Enum.UserInputType.MouseButton1 and not cd and c:FindFirstChild("Stun") == nil then
		c.Humanoid.WalkSpeed = 0
		c.Humanoid.JumpPower = 0
		
		if tick() - lasthit > 1 then
			combo = 1
		end
		lasthit = tick()
		
		cd = true
		
		anim.AnimationId = swingAnims[combo] 
		local load = c.Humanoid:LoadAnimation(anim) --  Sets load as animation to be accessed later
		print(load.AnimationId)
		load.Priority = Enum.AnimationPriority.Action
		print("e")
		load:Play()
		print("2")
		
		local data = {char = c, comboN = combo, action = "slash"}
		remote:FireServer(data)
		slash(c, combo)
		
		if combo == 5 then
			combo = 1
		else
			combo += 1
		end
		wait(0.1)
		
		cd = false
		
		c.Humanoid.WalkSpeed = 16
		c.Humanoid.JumpPower = 50
	end
end)

instead of playing the animation, it just acts like the load:play() didn’t exist

I have also tried loading the animation onto the animator instead of the humanoid.

this is in a local script btw

Maybe try using a animation instance and load every single animation?

for example;

local humanoid = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") -- gets humanoid
local blockidleanim = script.Parent:WaitForChild("whatever") -- gets the animation instance
local loadedblockidleanim = humanoid:LoadAnimation(blockidleanim) -- loads animation instance

loadedblockidleanim:Play() -- plays the loaded animation instance

wait but there is an animation instance im using thats the child of the local script

local anim = script:WaitForChild("Animation")

and later

	
		anim.AnimationId = swingAnims[combo] 
		local load = c.Humanoid:LoadAnimation(anim) --  Sets load as animation to be accessed later
		print(load.AnimationId)
		load.Priority = Enum.AnimationPriority.Action
		print("e")
		load:Play()
		print("2")

Im talking about like loading every single animation with its own instance.
example

But wouldn’t that result in a whole lot of instances if I even add more animations for different things that operate under this script?

Yes, it would, but if it works and that method doesn’t work then its worth it.

1 Like

nevermind not
that wasn’t what happened

Did you make the animation yourself?

If not, it has to be by you or the group, depending who the game is owned by

1 Like

I did

also from some testing it seems that no animation is playing correctly only in that 1 place, I dunno why, I copied some other animation code from another thing I had and although it worked fine in that game, it didn’t in this one

Does this have something to do with R6 animations not being able to play on R15 characters even though they have the same motors or something?

Ok yeah so apparently R6 animations would not play in R15 even if it has all rigs and motor6D compactible

welp guess thats something I just have to remember : (

1 Like