I been scripting basketball recently and in my module script theres a little problem. When I release the keybind. The ball just drops and doesn’t go near the goal please help. p.
The code: local module = {}
function module:percentage(Metersize, RootPart, Goal, Shotmeter, Meter, Percent)
if Metersize > 1 then
Metersize = 1 - (1 - Metersize) * -2
end
local BasePercent = (Metersize / 1) * 100
local Magnitude = (RootPart.Position - Goal.Position).magnitude
local Percent = math.floor(100 * (BasePercent / 100))
print(Percent)
return Percent
end
function module:caloffset(Percent, Metersize, RootPart, Goal)
local Max = 1.25
local Min = 0
local Arc = 0
local Percent = module:percentage(Metersize, RootPart, Goal)
if Metersize > .65 then
Arc = (Percent * (Min - -Max) / 100) + -Max
elseif Metersize < .65 then
Arc = (Percent * (Min - Max) / 100) + Max
end
return Arc
end
function module:Shoot(Metersize, Percent, RootPart, Ball, Goal)
local Arc = 15
local Mag = (RootPart.Position - Goal.Position).Magnitude
local Offset = 0
local T = 1.1 + (Mag / 110)
local G = Vector3.new(0, (workspace.Gravity / 3.45), 0)
local X0 = RootPart.Position
local V0 = (Goal.Position - X0 - .5 * G * T * T) / T / 1.045
Ball.Parent = workspace
Ball.Motor6D.Part0 = nil
Ball.CanCollide = false
Ball.Velocity = V0 + Vector3.new(Offset, Arc, Offset)
Ball.RotVelocity = Vector3.new(0, 0, 25)
wait(.25)
Ball.CanCollide = true
wait(1)
Ball.Owner.Value = ‘’
print(V0)
end
return module
The code you provided is from a module script. There must be another script that calls those functions stored in the module. I may be able to help you if you provide them.