Why does this script open other guis as well?

This is a major game breaking bug, and I have not found a way to fix it. When a player stands on a part, it shows everyone in the game the gui, instead of that player who touched it as well as showing all the guis instead of the one it was supposed to show. local script

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)

I’m not entirely sure where this local script is to begin with, but I would suggest putting the local script in the frame itself. Here’s how I would use a touched event:

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

function Touch(hit)
    if hit.Parent == character then
        script.Parent.Visible = true
    end
end

workspace:WaitForChild("ShopPart").Touched:Connect(Touch)
1 Like

The local script I used was in the frame.
it only shows for the player who touches it now, but it shows all the other guis.

I wrote a resource on this a while ago.

1 Like