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