I am making it so if a player touches a part they open a gui, but everyone in the game sees it instead of the player who touches it. Local script
local player = game.Players.LocalPlayer
function Touch(hit)
player.PlayerGui.ShopGui.Frame.Visible = true
end
workspace.ShopPart.Touched:Connect(Touch)
Run an if statement to make inside the function checking if the hit.Parent = player.Character.
Your problem is that whenever the part is touched by anyone it will open it on local players screen. You need to make it so it fires when touched by only the local player.
local player = game.Players.LocalPlayer
function Touch(hit)
if hit.Parent == player.Character then
script.Parent.Frame.Visible = true
end
end
workspace:WaitForChild("ShopPart").Touched:Connect(Touch)
local player = game.Players.LocalPlayer
function Touch(hit)
if hit.Parent == player.Character then
player.PlayerGui.ShopGui.Frame.Visible = true
end
end
workspace:WaitForChild("ShopPart").Touched:Connect(Touch)