Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do you let an player Resize an gui?

Asked by 4 days ago

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

Log in to vote
0
Answered by 4 days ago

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!

0
Sorry i messed up! Replace AbsoluteSize with AbsoulePosition! deadwalker601 33 — 4d
0
Thankyou @deadwalker601 Retallack445 12 — 4d
0
No problem deadwalker601 33 — 4d
Ad

Answer this question