My issue is in the title. It adds 2 instead of just 1.
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local isOn = false
for i,v in pairs(teleportParts) do
v.Touched:Connect(function(hit)
if not isOn and hit.Name == "HumanoidRootPart" then
for i,players in pairs(Players:GetPlayers()) do
if players.Name == hit.Parent.Name then
isOn = true
v.Parent.MainPart.SurfaceGui.PlayerCount.Count.Value = v.Parent.MainPart.SurfaceGui.PlayerCount.Count.Value + 1
end
end
end
end)
v.TouchEnded:Connect(function(hit)
if isOn and hit.Name == "HumanoidRootPart" then
for i,players in pairs(Players:GetPlayers()) do
if players.Name == hit.Parent.Name then
isOn = false
v.Parent.MainPart.SurfaceGui.PlayerCount.Count.Value = v.Parent.MainPart.SurfaceGui.PlayerCount.Count.Value - 1
end
end
end
end)
end
end)
end)
I have checked the table and there is only 1 teleport part

2 comments
nvm figured it out, the character was loaded multiple times
Put SOLVED in the title then (I think, I saw an admin say that once)