Do GUI buttons not work when in starterpack?

hey guys

I seem to be a little stuck.

tool.Equipped:Connect(function()
	if hasBook then
			openGuiClone = script.Parent.openGui:Clone()
			openGuiClone.Parent = game:GetService("Players").LocalPlayer.PlayerGui
			openGuiClone.Enabled = true
			isOpen = true
			if isOpen then
				openButton.MouseButton1Click:Connect(function()
					weaponGuiClone = script.Parent.weaponGui:Clone()
					weaponGuiClone.Parent = game:GetService("Players").LocalPlayer.PlayerGui
					weaponGuiClone.Enabled = true
					
					openGuiClone.Enabled = false
					isOpen = false
				end)
		else
			print("not working")
		end
	end
end)

when I equip my tool the first button appears, but when I click on it, it doesn’t do anything. I tried printing right after the click and nothing.
Only reason I can think off is that maybe buttons don’t work in starterpack?
It might as well be the most stupid mistake ever, I just can’t seem to find it lol.

help

btw: no errors or what so ever

Gui must be in playerGui or in a Surface/Billboard Gui to work you must use a gui inside the playerGui , i recommend for more simplicity to put a script to activate the gui and handle other in the gui

idk exactly what you mean. but I clone my gui’s to the PlayerGui.
First part works, just not the second lol.

What is the openButton assigned to? It may be the cause of your problem. Also, if you haven’t already, please use print() more often for troubleshooting, especially around functions or if statements.

you cloned the gui but did you modify the localscript too ?

openButton is assigned to the button inside the frame called ‘open’

local openButton = script.Parent:WaitForChild(“openGui”).open:WaitForChild(“button”)

and I use print constantly

I see the issue now.

You’re referencing the GUI in the Character when equipped, not the one in PlayerGui. Reference the one in the PlayerGui, as it will actually work. So after getting your openGuiClone variable, just put this below it:

openGuiClone = script.Parent.openGui:Clone()
local openButton = openGuiClone.open.Button
...
1 Like

Try to put the openButton event inside the GUI itselft.

you’re right, so it was just a stupid mistake lol.

Thank you and everyone.