Surface Gui Button not clickable

So I am coding a game where the menu is cloned from the replicatedStorage and put into the workspace. and the menu consist of a part with a surface gui inside of it. The adornee for the surface gui is set to the part. I have tried putting the surface gui menu into starter gui and setting the adornee from there but, that doesnt work either because, I can’t access the menu at all in player gui. The really weird part is it works more than half the times in studios and none of the time in a published roblox game. Any help would be greatly appreciated.

2 Likes

Update: It not consistently works in studios but will not work in game. Its a local script and the adornee is set.

Can you show the code for further assistance?

if dimMenu then
	local starterGui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
			
	local surfaceGui = Instance.new("SurfaceGui", starterGui)
	surfaceGui.Adornee = menu.Part
	
	surfaceGui.Name = "Menu"
			
	for _, guiChild in pairs(menuFrame.Parent:GetChildren()) do
		guiChild.Parent = surfaceGui
	end
			
	menuFrame = surfaceGui.Animals
end

Sorry I gave up on this for a while and just had it as a Screen Gui but I have come back to the menu to try and make it better.

But this is where the the surface gui is set up. (Coded it when I gave up trying in case I wanted to come back to it)

dimMenu = Setting in replicated storage
menuFrame = frame in screenGui

It works sometimes which is just so bizarre to me. And one of the frames has buttons on it that refuse to work period.

I got it to work. I just needed to do what I did above. Create screengui parent a surfacegui set the adornee to a part and then toggle always on top to true

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.