Invalid argument #2 (Vector3 expected, got number) when running CFrame.Angles/math.pi

I’ve had some trouble lately trying to get this work. When I try to run this, I get Invalid argument #2 (Vector3 expected, got number) at this line of code, “F.Velocity = (HRP.CFrame*CFrame.Angles(math.pi/height, direction, 0)) * power”. I have no clue why this is happening and have tried to put a Vector3.new value in the variable, but then returns a different error. I have no idea what’s happening, if anyone can help, that’d be great!

for i, v in pairs(Body) do
	character:FindFirstChild(v).Touched:Connect(function(hit)
		if react == false then return end
		if passing == true then return end
		if switch.Value == "Long/Shoot" then return end
		if debounce == true then return end
		if hit.Name ~= "Ball" then return end
		pwr = 20
		force = Vector3.new(4e+006, 4e+004, 4e+006)
		local h = 35
		local d = 0
		debounce = true
		Tool.Force(h, d, hit, pwr, force, true)
		wait(0.15)
		debounce = false
	end)
end
function Tool.Force(height, direction, hit, power, force, usage)
	if hit.Anchored == true then return end
	if hit.Owner.Value == player then
		local F = Instance.new("BodyVelocity")
		F.Name = "ReactVelocity"
		F.Velocity = (HRP.CFrame*CFrame.Angles(math.pi/height, direction, 0)) * power
		F.MaxForce = force
		F.Parent = hit
		Debris:AddItem(F, 0.3)
		end
1 Like

what is stored in the variable pwr? If its a number you cannot multiple CFrames by a number it either has to be a vector3 or another CFrame

1 Like
  1. Shouldn’t be important, since that’s not the part what’s breaking.
    (math.pi/height, direction, 0)
    This part is most likely breaking, I have no clue why.
1 Like

Yes it does if its a number you cannot multiply a cframe by a number

1 Like

Oh, I get what you mean. I’ll write a workaround for that then. Thanks!