i keep getting the "LoadAnimation requires an Animation object" error on line 36 on a serverscript and have no clue what is wrong with it this is the script i'm using

local rp = game:GetService("ReplicatedStorage")
local Punch = rp:WaitForChild("Punch")

local Animations = script:WaitForChild("Animations")

local R15 = 
{
	["L"] = Animations.R15.Combat1,
	["LL"] = Animations.R15.Combat2,
	["LLL"] = Animations.R15.Combat3,
}

local R6 = 
{
	["L"] = Animations.R6.Combat1,
	["LL"] = Animations.R6.Combat2,
	["LLL"] = Animations.R6.Combat3,
}

Punch.OnServerEvent:Connect(function(Player,combatSequence)
	local Character = Player.Character
	local Humanoid = Character.Humanoid
	local HumanoidRP = Character.HumanoidRootPart
	
	local Stand = Character:FindFirstChild("Stand")
	if Stand then
		--if stand is found
		local AnimControl = Stand:FindFirstChild("AnimControl")
		if AnimControl then
			
			--/Animation to be played
			local Action
			
			local HumanoidType = AnimControl:FindFirstChild("HumanoidType")
			if HumanoidType.Value == "R15" then
				Action = AnimControl:LoadAnimation(R15[combatSequence])
				
			elseif HumanoidType.Value == "R6" then
				Action = AnimControl:LoadAnimation(R6[combatSequence])
				
			end
			Action:Play()
			
			Action.Stopped:Connect(function()
				Punch:FireClient(Player,true)
			end)
			
		end	
	else
		--if stand is not found
		Punch:FireClient(Player,false)
		
	end	
end)

4 comments

0

R15[combatSequence] can just be NOT a animation obj.

0

i do not understand what you meant (english is not my first language sorry)

0

You didn't like give the correct argument for :LoadAnimation. Is R15[combatSequence] nil? Can you show me the script where you fire the server?

0

Nil means equal to nothing