Roblox sliding UI does not work

Hello. I made a slide UI, but it doesn’t work.
Here is my code:

local button = script.Parent;
local isDown = false;
local outerLine = script.Parent.Parent.OuterLine;
local runService = game:GetService("RunService");
local player = game.Players.LocalPlayer;
local mouse = player:GetMouse();

function button_Down()
	isDown = false

function button_Up()
	isDown = true

function render_Step()
	if not isDown then return end;
	outerLine.Position =, math.clamp(mouse.X, 0, 483), 0, 0.486)




Any help?

1 Like

From what I see in your code the value of isDown never changes from false since button_Down() and button_Up() are never called.

You have a line in your RenderStepped function that prevents the code from going forward if isDown is false.

if not isDown then return end;

They are called at the bottom of the script

My bad. Didn’t see that you could scroll down.

1 Like

Are you trying to be able to drag it along the X axis?

I already know the reason, it is because Mouse.X returns the Position according to the Roblox window frame, but the frame that I move is parented to a frame object (which changes the way the object position changes accordingly), if I like move my mouse a lot to the left, it does drag that.
(I hope you get my point, I am not a native English speaker)

1 Like

I just did it! I just had to minus the AbsolutePosition’s X axis minus the frame’s position’s X axis.