Gui Button Not Working

I am trying to make a back button work but it decided it does not want to work.

https://streamable.com/irgrj2

-- Settings Button Handler

Main.Settings.MouseEnter:Connect(function()
	Main.Settings:TweenSize(
		UDim2.new(0, 120, 0, 120), -- Size
		"Out", -- Easing Direction
		"Quint", -- Easing Style
		".5" -- Time in seconds
	)
end)

Main.Settings.MouseLeave:Connect(function()
	Main.Settings:TweenSize(
		UDim2.new(0, 100, 0, 100), -- Size
		"In", -- Easing Direction
		"Quint", -- Easing Style
		".5", -- Time in seconds
		true
	)
end)

Main.Settings.MouseButton1Click:Connect(function()
	script.Parent.Main.Enabled = false
	script.Parent.Settings.Enabled = true
end)

Settings.Back.MouseButton1Click:Connect(function()
	script.Parent.Settings.Enabled = false
	script.Parent.Main.Enabled = true
end)

-- End

Can you include the part of the script where you assign your variables?

1 Like

I think the main issue comes from overlapping buttons and it becomes incredibly hard to press the correct one when they overlap each other like that.

Unless they have been arranged neatly, I cannot identify the issue.

Yes.

local Settings = script.Parent.Settings
local Main = script.Parent.Main

--Background Handler

script.Parent.Background.Changed:Connect(function(newVal)
	if newVal == 1 then
		script.Parent.Main.Background1.Visible = true
		script.Parent.Main.Background2.Visible = false
		script.Parent.Main.Background3.Visible = false
		
		script.Parent.Settings.Background1.Visible = true
		script.Parent.Settings.Background2.Visible = false
		script.Parent.Settings.Background3.Visible = false
	elseif newVal == 2 then
		script.Parent.Main.Background1.Visible = false
		script.Parent.Main.Background2.Visible = true
		script.Parent.Main.Background3.Visible = false
		
		script.Parent.Settings.Background1.Visible = false
		script.Parent.Settings.Background2.Visible = true
		script.Parent.Settings.Background3.Visible = false
	elseif newVal == 3 then
		script.Parent.Main.Background1.Visible = false
		script.Parent.Main.Background2.Visible = false
		script.Parent.Main.Background3.Visible = true
		
		script.Parent.Settings.Background1.Visible = false
		script.Parent.Settings.Background2.Visible = false
		script.Parent.Settings.Background3.Visible = true
	end
end)

-- Settings Button Handler

Main.Settings.MouseEnter:Connect(function()
	Main.Settings:TweenSize(
		UDim2.new(0, 120, 0, 120), -- Size
		"Out", -- Easing Direction
		"Quint", -- Easing Style
		".5" -- Time in seconds
	)
end)

Main.Settings.MouseLeave:Connect(function()
	Main.Settings:TweenSize(
		UDim2.new(0, 100, 0, 100), -- Size
		"In", -- Easing Direction
		"Quint", -- Easing Style
		".5", -- Time in seconds
		true
	)
end)

Main.Settings.MouseButton1Click:Connect(function()
	script.Parent.Main.Enabled = false
	script.Parent.Settings.Enabled = true
end)

Settings.Back.MouseButton1Click:Connect(function()
	script.Parent.Settings.Enabled = false
	script.Parent.Main.Enabled = true
end)

-- End