How Do I Make Vertical Sliding Bar

Hey Guys So I want to make a vertical sliding gui but in this case roblox messed it up,
Jepretan Layar 2022-01-21 pukul 19.19.38

So the starting point of mouse cursor is on top left corner ( 0x, 0y )

So The Sliding Gui Got Messed Up Too

So The Slider Is Inverted :expressionless:

In slider gui, when tweening the size, change the positive to negative or negative to positive, so you can fix it.

yes but let me try and let you look at it

It Start From The Negative Line

Can you please send your code?

local inn = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local max = script.Parent
local ap = Vector2.new(max.AbsolutePosition.X, max.AbsolutePosition.Y)
local as = Vector2.new(max.AbsoluteSize.X, max.AbsoluteSize.Y)
local bar = script.Parent.Frame
local uis = game:GetService("UserInputService")

script.Parent.Detec.MouseButton1Down:Connect(function()
	inn = true
end)
uis.InputEnded:Connect(function(input, gp)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		inn = false
	end
end)

mouse.Move:Connect(function()
	if inn then
		if mouse.Y < ap.Y then
			bar.Position = UDim2.new(-0.357, 0, 0, 0)
		elseif mouse.Y > (ap.Y + as.Y) then
			bar.Position = UDim2.new(-0.357, 0, 0, as.Y)
		else --within bounds
			bar.Position = UDim2.new(-0.357, 0, 0, math.floor((math.floor(mouse.Y) - ap.Y)))
		end
	end
end)

Jepretan Layar 2022-01-21 pukul 20.21.57

local Max = 200
local Min = -200
local Currentvalue = 0
local Holding = false
local mouse = game.Players.LocalPlayer:GetMouse()
local back = script.Parent.Parent
local moveframe = script.Parent
local APY = back.AbsolutePosition.Y
local ASY = back.AbsoluteSize.Y

back.MouseButton1Down:Connect(function()
	mouse.Button1Down:Connect(function()
		Holding = true
	end)
end)
mouse.Button1Up:Connect(function()
	Holding = false
end)

while wait() do
	if Holding == true then
		local MY = mouse.Y
		local Pos = math.clamp(MY-APY,0,back.AbsoluteSize.Y)
		moveframe.Position = UDim2.new(0,0,0,Pos)
		Currentvalue = math.round(math.clamp(Max + (Min - Max)*(Pos/ASY), Min, Max))
		print(Currentvalue)
	end
end

new code
make sure backframe is a text button or just a button and moveframe is well a frame

hmmm, can you show the directory of the frame,button etc ?

the directory is ur frame and button

just make a button and in the button add a frame and in the frame add a local script and paste the code in the local script and you will be done!

1 Like

This can handle it all for you: SliderService - Create easy and functional Sliders!

bar.Position = UDim2.new(-0.357, 0, 0, (ap.Y + as.Y) - mouse.Y) 

All you needed to do was get the frame’s absolute starting position on the y-axis and add to it the frame’s absolute size along the y-axis, this calculated value should represent the y-axis at which corresponds with the bottom of the frame, from there all you need to do is subtract the y-axis co-ordinate of the mouse cursor’s current position.

1 Like