Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Positioning the GUI with a local script not working?

Asked by 3 years ago

I have a script that when a button is clicked it opens a menu and changes the toggle button's position so that it is visible but changes the position to the top left corner instead of above the menu, how do i fix it?

Openpos = UDim2.new({8.39, 0},{0.543, 0})
ClosePos = UDim2.new({8.39, 0},{0.922, 0})

MenuOpen = false

MenuButton = script.Parent.MenuToggle
MenuFrame = script.Parent.MenuFrame

MenuButton.MouseButton1Click:Connect(function()
    if MenuOpen then
        MenuOpen = false
        MenuButton.Position = ClosePos
        MenuButton.Text = "Open Menu"
        MenuFrame.Visible = false
    elseif not MenuOpen then
        MenuOpen = true
        MenuButton.Position = Openpos
        MenuButton.Text = "Close Menu"
        MenuFrame.Visible = true
    end
end)
0
If you want to move it in a script then, use tween. If you just want to only change the menu's Position then, just adjust the position to middle. Hope this helpful! uiuiuiuihauahua67 15 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

You need to take the {} out of the positions. it should just be 4 numbers.

Openpos = UDim2.new(8.39, 0,0.543, 0)
ClosePos = UDim2.new(8.39, 0,0.922, 0)
0
Thanks! jedistuff2 89 — 3y
Ad

Answer this question