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

Click Detector won't pop up GUI?

Hello Ive been trying to make a script that pops up a GUI whenever you use a click detector inside a model. Here's the code.

script.Parent.MouseClick:connect(function()
	script.Parent.Parent.Parent.Parent.StarterGui.CharacterBattle.Frame.Visible = true
end)

However it does not work. Whenever I click the model nothing happens.

1 comment

0

If you set the size of a GUI in StarterGui, it does not edit the player's GUI.

1 answer

✓ Accepted answer

Firstly, your script doesn’t work because StarterGui is not where player’s guis are stored. After a player joins the game, each gui in StarterGui is replicated into their PlayerGui, which is individual to that player.

Secondly, because guis are individual to the player, they can only be edited through local scripts. To fix this, you could do something like this in a local script inside the gui that you want to make visible:

local click = workspace["ModelNameHere"].ClickDetector
click.MouseClick:Connect(function(hit)
	if hit == game.Players.LocalPlayer then
		script.Parent.Visible = true
	end
end)

1 comment

0

Ah thank you very much

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