Opening a Gui with a Clickdetector

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? To fix this issue

  2. What is the issue? I’m trying to use a Clickdetector to make a Gui visible but it isn’t working, it’s a localscript inside of the starterplayerscripts and I’m not getting any errors and the Gui is in StarterGui.

local Detector = game.Workspace.Clickpart.ClickDetector

Detector.MouseClick:Connect(function()
	game.Players.LocalPlayer.PlayerGui.ShopGui.Frame.Button.Visible = true
	game.Players.LocalPlayer.PlayerGui.ShopGui.Frame.Frame.Visible = true
end

You have parentheses that are left opened. Add a parentheses after the end.

Detector.MouseClick:Connect(function()
	--Code
end) --Here is where the error was.

That still doesn’t work and I don’t know why.

Have you tried using MouseButton1Down as a replacement for MouseClick?

EDIT: Never mind, that isn’t a property of Click Detectors.

Still doesn’t want to work, no errors.

This works

LocalScript in StartPlayerScripts

local Detector = game.Workspace.Clickpart.ClickDetector

Detector.MouseClick:Connect(function(plr)

game.Players[plr.Name].PlayerGui.ShopGui.Frame.Visible = true
game.Players[plr.Name].PlayerGui.ShopGui.Frame.Frame.Visible = true
end)

Was that ran in a server or local script?

1 Like

Have you tried firing a RemoteEvent?

Hey, maybe it’s easier to send a file?

It’s a regular Localscript located in starterplayerscripts with the code I sent