I have created a button that when is clicked it opens your shop GUI. It works!; except the fact that every time the button is clicked (doesn't matter who) you're shop opens up. Is there a way to make it so that you're shop opens up only if the person that clicked the button is you?
When using a click detector the MouseClick event returns the player who click so:
Workspace.Part.ClickDetector.MouseClick:connect(function(playerWhoClicked) print("Part was clicked by: " .. playerWhoClicked.Name) end)
Basically when doing this the playerWhoClicked you can get the player in game.Players or however you're opening to only open for the player that clicked. For more info on the click detector check out the wiki: Click Detector
The MouseClick event returns the player who clicked the ClickDetector. Script:
function onClick(player) player.Character.PlayerGui.ShopGui.Enabled = true end script.Parent.ClickDetector.MouseClick:connect(onClick(player))