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)
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!
I solved it. I just ran a local script from the StarterGui.