Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a shop Gui only open for one person?

Asked by 3 years ago

I want to make a shop where you buy tools but when the shop opens it opens for everyone in the server. I have made it so when you press on a green circle the shop Gui opens and you can buy tools but it opens for every player in the game. I have tried with my friend and we both get the shop Gui when only one of us steps on the circle. I really need help fixing this since my game wont work if this happens. Here is the code that i have made:

game.Workspace.ShopPart.Touched:Connect(function(hit)

if hit then

script.Parent.Shop.Frame.Visible = true

end

end)

If you have any solutions i would really appreciate it!

0
Are you using a surface GUI? DarkDanny04 407 — 3y
0
No I am using a screen Gui. Vilton1o 7 — 3y

1 answer

Log in to vote
0
Answered by
OhManXDXD 445 Moderation Voter
3 years ago

You aren't cloning it to the player who hit it specifically.

game.Workspace.ShopPart.Touched:Connect(function(hit)

if hit:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)

gui = script.Parent.Shop:Clone()
gui.Parent = plr.PlayerGui
gui.Frame.Visible = true

end

end)
Ad

Answer this question