So my problem is that this GUI shows for everybody This is the script that shows the GUI
game.Workspace.ShopPart.Touched:Connect(function(hit) if hit then script.Parent.Shop.Frame.Visible = true end end)
I tried everything I knew but it didn't work out. Does anyone know what can I do with this code to fix it?
game.Workspace.ShopPart.Touched:Connect(function(hit) if hit:IsA("BasePart") then -- checking if hit isnt accessory or something like that if hit.Parent:FindFirstChild("Humanoid") then -- if we can find Humanoid inside hit.Parent if yes, then hit.Parent is player local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- hit can be Arm, Head, Torso so we want Parent of that which is player player.PlayerGui.Shop.Frame.Visible = true -- you need to put that gui inside StarterGui end end end)
script.Parent.Shop.Frame.Visible=game.Players.LocalPlayer.Name==hit.Parent.Name