There are no errors? I expect the code to move the part in the direction of the mouse if you are top down on the part.

local plr = game.Players.LocalPlayer
local Ball = nil
local Screensize = script.Parent:WaitForChild("Shadder").AbsoluteSize

function glideTorwards(currentValue,targetValue,rate)
	if currentValue < targetValue then
		return math.min(targetValue,currentValue + rate)
	elseif currentValue > targetValue then
		return math.max(targetValue,currentValue - rate)
	else
		return targetValue
	end
end

function WFB()
WFBRequire()
while wait() do
local Ba = _G.PlayerBall
	if Ba ~= nil then
		return Ba
	end
end
end

function WFBRequire()
	local MouseY = nil
	local MouseX = nil
	if plr:GetMouse().Y > Screensize.Y/2 then
		MouseY = 2
	elseif plr:GetMouse().Y < Screensize.Y/2 then
		MouseY = -2
	end
	if plr:GetMouse().X > Screensize.X/2 then
		MouseX = 2
	elseif plr:GetMouse().X < Screensize.X/2 then
		MouseX = -2
	end
	repeat wait() until Ball ~= nil
	while wait() and Ball ~= nil do
		Ball.Position = Vector3.new(glideTorwards(Ball.Position,(Ball.Position + Vector3.new(MouseX,0,MouseY)),2))
	end
	WFB()
end

Ball = WFB()

3 comments

0

Please add more information like what you expect the code to do and what the code is actually doing. We have no idea what "working" means for you, so we can't help you make it work.

0

"if you are top down on the part." What? Restate this please, and what isn't working about the code.

0

What exactly isn't working? If you don't know, spam your code with print()'s to see what's going on.