Touching part with two players at same time problem

Hi, when i touch the same part with two different players the gui changes visibility and thats a problem

stuck

this is the code i have in a local script:

local Workspace = game:GetService(“Workspace”)
local Players = game:GetService(“Players”)

local client = Players.LocalPlayer
local part = game:GetService(“Workspace”):WaitForChild(“touchToEquipChair”)
local debounce = true

part.Touched:Connect(function(other)
local character = client.Character
client.PlayerGui.test.t1.Visible = other:IsDescendantOf(client.Character)
if debounce == true then

	repeat
		wait()
	until (character.HumanoidRootPart.Position - part.Position).magnitude > 10		
	debounce = false
	wait(0.2)
	debounce = true
end
client.PlayerGui.test.t1.Visible = false

end)

how i can solve this without remote events???

Similar solution as @hamsterloverboy3, but you can use.

if Players:GetPlayerFromCharacter(other.Parent) == client then
-- continue code
1 Like

thx a lot i been like 1-2 hours to solve this lol