I parented the shop to each new player's camera since if it's in the playerGUI folder the brick isn't visible for the shop and you can't even click the gui buttons. Here's the code I have but it's not working. I've tried putting it in LocalScript and Server Script but it doesn't work and yes, I'm in Start Server -> Start Player.
Hierchy: Workspace +Camera(CurrentCamera) ++screenPiece +++back ++++shop stuff +++++buy1 ++++++script
local player = game.Players.LocalPlayer
local resources = player.resources
local tool = game.ServerStorage.Flashlight
local cost = 25
function onClick(player)
if resources.Value >= cost then
tool:Clone().Parent = player.Backpack
resources.Value = resources.Value - cost
end
end
script.Parent.MouseButton1Click:connect(onClick)

3 comments
Not working dude.
10:43:28.318 - PlayerGui is not a valid member of Players 10:43:28.319 - Script 'Players.Player2.PlayerGui.playerSetup', Line 1 10:43:28.319 - Stack End
Is it a LocalScript in starterGui?