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

How do you make a part open a gui when touched but only for the player that stepped on it?

Asked by 3 years ago
Edited 3 years ago

In my game when you touch a part it opens the gui but when you step on the part it opens on all players screens in the server.Help me.

Heres my script:

game.Workspace.ShopBuilding2.ShopPart.Touched:Connect(function(hit) if hit then script.Parent.Shop.Frame.Visible = true end end)

1 answer

Log in to vote
0
Answered by 3 years ago

Put the script and the ScreenGui on the part, then put this on the script:

script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    script.Parent.Gui:Clone().Parent = player.PlayerGui
end)

Accept the answer if it worked!

Ad

Answer this question