*Sorry if my code is incorrect or other stuff
My ball keeps teleporting to in front of me, I dont know why. Heres a video of what is happening:
robloxapp-20220206-1314210.wmv (482.0 KB)
This is my Code,
wait(3)
print('Script started')
local Mouse = game.Players.LocalPlayer:GetMouse()
local Start = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
local End = workspace.CurrentCamera:ScreenPointToRay(Mouse.X, Mouse.Y, 0).Origin
local Mid = Vector3.new(Start.X, (Start.Y+End.Y)*4, (Start.Z+End.Z)/2)
local Move = script.Parent.Handle
local function Cac(p0, p1, t)
return p0 + (p1 - p0) * t
end
Mouse.Button1Down:Connect(function()
print("Mouse clicked")
Move.Anchored = false
script.Parent.Parent = game.Workspace
for i = 0, 10, 0.3 do
i = i/10
local l0 = Cac(Start, Mid, i)
local l1 = Cac(Mid, End, i)
local val = Cac(l0, l1, i)
Move.Position = val
wait(0.0001)
end
wait(5)
end)