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

Positioning the GUI with a local script not working?

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)

1 comment

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!

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks!

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