Invalid argument #3 (Vector3 expected, got number)

Hello, i was developing my soccer game and i have a problem that i never had, for some reason, the most normal method to kick the ball is in a invalid argument, this just happend to me, there is tons of soccer games that uses the same method and their games works, i dont really know if im doing something wrong but i use the same method everytime [Apply ball force with module]

Module error part:

function Mechanics.ApplyForce(Hit,Force,MaxForce,BodyPart)
Mechanics.RemoveForce(Hit)
Mechanics.React(Hit)
local Velocity = Instance.new("BodyVelocity")
Velocity.Parent = Hit
Velocity.MaxForce = MaxForce
Velocity.Velocity = BodyPart * Force
Debris:AddItem(Velocity, 0.3)
end

And this is how i use it in the kick tools:

local function AddForce(Hit,Velocity,Force,Limb,Bool)

DribbleR = false

Main.ApplyForce(Hit,Velocity,Force, "Right Leg", true)

end

> if Main.StrongFoot() == "R" then
>   AddForce(Hit,Angle,Power,"Right Leg",true)
> elseif Main.StrongFoot() == "L" then
>   AddForce(Hit,Angle,Power,"Left Leg",false)
> end

Someone knows how to fix this?

Can we see how you are doing the Force? it needs to be a Vector3.

There is no more information about adding forces in the module because i only use it to storage filterin enabled methods and some client sided events, im doing this right now in the kick tool.

local Power = 0

local Angle = Vector3.new(0, 0, 0)

   local function AddForce(Hit,Velocity,Force,Limb,Bool)
	DribbleR = false
	Main.ApplyForce(Hit,Velocity,Force, "Right Leg", true)
end

When detects the ball:

AddForce(Hit,Angle,Power,"Left Leg",false)

Alright, so the .MaxForce value of the Body Velocity needs to be a Vector3. A simple way to fix this will be to do Vector3.new(MaxForce, MaxForce, MaxForce)

1 Like

Thank you so much bro!! You really helped me

1 Like