I am in need of some help with angles!

Hello! I am currently scripting a ball for my soccer/football game, but I need some help with angles.

Part of script:

local Root = Character:FindFirstChild("HumanoidRootPart")
local Direction = CFrame.lookAt(Root.Position, Ball.Position).LookVector
if Direction.Magnitude < 0.001 then
	return
end
local Velocity = Instance.new("BodyVelocity")
Velocity.Parent = Ball
Velocity.MaxForce = Vector3.new(1, 1, 1) * math.huge
Velocity.Velocity = (Direction.Unit * Kick_Force) + Vector3.new(0, Kick_Force *Settings.Kick_Height, 0)
Services.Debris:AddItem(Velocity, 0.2)

local Direction = CFrame.lookAt(Root.Position, Ball.Position).LookVector

I want the direction to change to where the player is facing, not the angle the ball came from.
Because right now, if I hit it with my left arm, it goes to the left, but I want it to go to the direction my character is facing. I need some help asap.

Thanks!

So determine the direction where the root of the humanoid is looking

HumanoidRootPart.CFrame.LookVector

1 Like

Works! Thanks for the help. I really appreciate it

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