Show GUI to only one player when touch a part

hi, when player touch a part same gui is visible to all players, i only need to be visible to one player only, this is my code stored in local script at starter gui:

local part = game:GetService(“Workspace”):WaitForChild(“touchToEquipChair”)

part.Touched:Connect(function()
game:GetService(“Players”).LocalPlayer.PlayerGui.test.t1.Visible = true
end)

how do i solve this without using remote events??

local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")

local client = Players.LocalPlayer
local part = game:GetService("Workspace"):WaitForChild("touchToEquipChair")

part.Touched:Connect(function(other)
    client.PlayerGui.test.t1.Visible = other:IsDescendantOf(client.Character)
end)

Since Touched fires when a part is touched by another, you need to check that the part that touched belongs to the character.

2 Likes

Nice didnt know about :IsDescendantOf thing thx a lot!!