Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you let an player Resize an gui?

So as i said in the Title i want to make a gui that a local player can resize like they can change the (x,y) axes.

is that even Possible?

1 answer

✓ Accepted answer

First, this is possible and you asked just when I was finished making one!

We need to be able to start the resize so put a button in the frame.

Next we need to detect when the player starts the resize:

local btnDown = false
local frame = --Path to scaling object
local button = --Path to button
button.MouseButton1Down:connect(function()
	--Runs when mouse clicks the button
 	btnDown = true
end)

button.MouseButton1Up:connect(function()
	--Runs when the mouse is up
	btnDown = false
end)

Now we need to actually resize the frame:

local mouse = game.Players.LocalPlayer:GetMouse()
local btnDown = false
local frame = --Path to scaling object
local button = --Path to button
button.MouseButton1Down:connect(function()
	--Runs when mouse clicks the button
 	btnDown = true
end)

button.MouseButton1Up:connect(function()
	--Runs when the mouse is up
	btnDown = false
end)

mouse.Move:Connect(function()
	if btnDown then
		frame.Size = UDim2.new(0,mouse.X,0,mouse.Y) - UDim2.new(0,frame.AbsoluteSize.X,0,frame.AbsoluteSize.Y,0)
	end
end)

Please accept this answer if it works!

3 comments

0

Sorry i messed up! Replace AbsoluteSize with AbsoulePosition!

0

Thankyou @deadwalker601

0

No problem

This discussion is preserved as it was. New answers, comments, and votes are closed.