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

GUI Visible yet Not Showing?

Heya Guys! I am Currently making a model to where when you click a part a GUI Becomes visible


Menu = game.StarterGui.PopUpMenu.Frame

function onClicked() 
Menu.Visible = true
end 

script.Parent.ClickDetector.MouseClick:connect(onClicked)

For some reason it didnt become visible. While I was testing in character on studio, I scrolled down its Properties and it read Visible. Any help?

3 answers

✓ Accepted answer

Your problem is that your setting the gui in StarterGui visible. You need to set the gui in the player to visible.

function onClicked(player)
	player.PlayerGui.Menu.Visible = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

This should work. Let me know if it doesn't.

StarterGui is where gui's are cloned from, into the player. If you respawn, you will see the changes made. Instead, you need to access the player's PlayerGui. I recommend changing your script to a LocalScript, then making it's code as follows:

local player = game.Players.LocalPlayer

local menu = player.PlayerGui:WaitForChild("PopUpMenu").Frame

script.Parent.ClickDetector.MouseClick:connect(function() -- shorter way of doing functions
	menu.Visible = true
end)

2 comments

0

Workspace.Model.Menu.Script:3: attempt to index local 'player' (a nil value)

0

Is it a LocalScript?

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