I’m trying to make a dunk key bind using BodyPosition, however, my player always goes to the left side of the rim as shown:
I’ve tried switching the goal variable to a part at the centre of the hoop but this has yielded no results.
function rotateToHoop()
local hoop = GetGoal()
local goal = hoop.green
local bg = Instance.new("BodyGyro", Root)
bg.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bg.P = 25000
spawn(function()
bg.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Vector3.new(goal.Position.X, plr.Character.HumanoidRootPart.Position.Y, goal.Position.Z))
wait (.5)
bg:Destroy()
end)
end
local function gotoHoop()
local hoop = GetGoal()
local goal = hoop.green
local bodyPos = Instance.new("BodyPosition", Root)
bodyPos.D = 1100
bodyPos.P = 9000
spawn(function()
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyPos.Position = goal.Position - Root.CFrame.LookVector * 1.8
wait(1.1)
bodyPos:Destroy()
end)
end
This is how I structure my code, is there any way of solving this issue?
Thanks in advance!
-SpaceHex-