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

[SOLVED] Why is my shop gui not appearing?

So I'm working on a game that uses ClickDetect on a part to open my shop. It works perfectly in play solo, but as soon as I publish it and play it online the shop Gui won't open.

Here is the script:

script.Parent.MouseClick:connect(function(playerWhoClicked)
	if game.Players.LocalPlayer.PlayerGui:FindFirstChild("Shop") == nil then
		game.StarterGui.Shop:Clone().Parent = game.Players.LocalPlayer.PlayerGui
	end
  game.Players.LocalPlayer.PlayerGui.Shop.Background.Visible = true
end)

2 comments

0

Is the local script in Workspace? That would be the problem.

0

Yeah. Where would I need to put it for it to work?

2 answers

Make Sure It's A Local Script!

On line 5, try getting rid of Background and just using Visible. game.Players.LocalPlayer.PlayerGui.Shop.Visible = true. Also, you don't need lines 2-4 because you can be assured that roblox will copy everything from the StarterGui at the beginning of the game. You might also want to check if the Shop is already visible. Example,

script.Parent.MouseClick:connect(function()
    if game.Players.LocalPlayer.PlayerGui.Shop.Visible == false then
        game.Players.LocalPlayer.PlayerGui.Shop.Visible = true
    else
        game.Players.LocalPlayer.PlayerGui.Shop.Visible = false
    end
end)

I hope this works. Good Luck!

3 comments

0

It didn't work sadly.

0

Oh, I forgot to remove the Background

0

I'm an idiot. I was missing an end.

I solved it. I just ran a local script from the StarterGui.

1 comment

0

Good for you!

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