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

When I click a part with a click detector the gui is not visible?

Hello, I haven't coded in a looong time, I need some to solve this error. I have a click detector that will show a frame in the screengui when the part that is the parent of the clickdetector is clicked, the frame will become visible.

The frame is Visible is set to False

The code

game.Workspace.Part.ClickDetector.MouseClick:Connect(function()
	game.StarterGui.ScreenGui.background.Visible = true
end)

Also this is only supposed to show for the player, any help is great, thank you.

2 answers

You should do that on server side, by cloning the gui stored (RepStorage or ServerStorage) to playergui!

Server:

local gui = --put the local of stored gui as mentioned above 
game.Workspace.Part.ClickDetector.MouseClick:Connect(function(player)
     guiClone = gui:Clone()
     guiClone.Parent = player.PlayerGui
end)

To close it I recommend putting a button the ui itself but you can always remove it from the server!

I did not test it but I`m sure it will work so try it out! If not tell me so I can help you!

Well, I'm sure a little fix would help;

local Block = game.Workspace.Part
local ClickDetector = Block.ClickDetector

local StarterGui = game:GetService('StarterGui')
local Gui = StarterGui.ScreenGui.background


local function MouseClick()
	Gui.Visible = true

	if Gui.Visible == true then
		print('Visible')
	end

end

ClickDetector.MouseClick:Connect(MouseClick)
-- Note: Maker Sure This Is A LocalScript And Make Sure You Put It Inside The StarterGui

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