I have a problem with the knockback, The CFrame isnt working and is bringing up the error "ServerScriptService.CombatSystem:79: invalid argument #1 to 'new' (Vector3 expected, got number)" Please help

Problem:

goal.CFrame = CFrame.new ((Humrp.CFrame * CFrame.new (0,0 -15)).p, Humrp.CFrame.p) local info = TweenInfo.new(.5) local tween = TweenService:Create(enemyHumrp,info,goal) tween:Play()

Script:

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

local Debris = game:GetService("Debris")

local TweenService = game:GetService("TweenService")

local Animations = script:WaitForChild("Animations") local EnemyAnims = script:WaitForChild("EnemyAnims") local Meshes = script:WaitForChild("Meshes")

local anims = { Animations:WaitForChild("LeftPunch"), Animations:WaitForChild("RightKick"), Animations:WaitForChild("RightPunch"), Animations:WaitForChild("LeftKick"), }

local eAnims = { EnemyAnims:WaitForChild("EnemyLeftP"), EnemyAnims:WaitForChild("EnemyRightK"), EnemyAnims:WaitForChild("EnemyRightP"), EnemyAnims:WaitForChild("EnemyLeftK") }

local limbs = { "LeftHand", "RightFoot", "RightHand", "LeftFoot", }

local Damage = 10

Combat.OnServerEvent:Connect(function(player, count) local Character = player.Character local Humanoid = Character:WaitForChild("Humanoid") local Humrp = Character:WaitForChild("HumanoidRootPart")

local attack = Humanoid:LoadAnimation(anims[count])
attack:Play()

local Limb = Character:WaitForChild(limbs[count])

local folder = Instance.new("Folder",Character)
folder.Name =  player.Name.." Melee"

local Hitbox = Meshes:WaitForChild("HitBox"):Clone()
Hitbox.CFrame = Limb.CFrame
Hitbox.Parent = folder
Debris:AddItem(Hitbox,.5)

local weld = Instance.new("ManualWeld")
weld.Part0 = Hitbox
weld.Part1 = Limb
weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0

Hitbox.Touched:Connect(function(Hit)
	if Hit:IsA("BasePart") then
		if not Hit:IsDescendantOf(Character) then
			local enemyHumanoid = Hit.Parent:FindFirstChild("Humanoid")
			local enemyHumrp = Hit.Parent:FindFirstChild("HumanoidRootPart")
			
			if enemyHumanoid and enemyHumrp  then
				Hitbox:Destroy()
				
				enemyHumanoid:TakeDamage(Damage)
				
				local react = enemyHumanoid:LoadAnimation(eAnims[count])
				react:Play()
				
				if count == 4 then
					local goal = {}
					goal.CFrame = CFrame.new ((Humrp.CFrame  *  CFrame.new (0,0 -15)).p, Humrp.CFrame.p)
					local info = TweenInfo.new(.5)
					local tween = TweenService:Create(enemyHumrp,info,goal)
					tween:Play()
					
				end
				
			end
		end
	end
end)

Combat:FireClient(player)

end)

2 comments

0

I actually request code blocking the whole script so it would be easier for us to understand.

0

What is line 79