I have a pretty complicated problem, see, I have 4 different scripts though they are all either local scripts for my gui or server scripts for my detection and teleportation. I don’t know whether or not the 2 server scripts affect it though they are linked to the local scripts through remote events and I couldn’t find a problem in my local scripts. I want the server to detect when there are 0 players on a team and tell the local script to send a gui to all the players about what team won and teleport them to the lobby place. However, when I tried this if a player from one team died, the player who was on the other team(team one for example) would be the only player to see the win message and when the other player died(on team 2 for example), both players saw a gui, though the gui said that the team of the player that died won(team 1 player), even though that doesn’t make sense. The code never presented a problem in the output except that the players couldn’t teleport in roblox studio, which means that somehow, the script is adressing the wrong text label to show. there is a lot of code to look at but I thought background might help someone understand it.

Team 1 win local script

local Teams = game:GetService("Teams")
local label = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("PistolPalsRemoteEvent")
local TeamOne = Teams.TeamOne
local PlayerAmount = TeamOne:GetPlayers()
local player = game.Players.LocalPlayer
TeleportService = game:GetService("TeleportService")

label.Visible = false

local function onNotifyPlayer()
	wait()
	local Val = #PlayerAmount
	if Val == 0 then
		label.Visible = true
		wait (4.5)
		label.Visible = false
	end
end

remoteEvent.OnClientEvent:Connect(onNotifyPlayer)

Team 1 server script

local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("PistolPalsRemoteEvent")
local Teleport = game:GetService("TeleportService")
local placeID = 6283305049
local TeamOne = Teams.TeamOne
local PlayerAmount = TeamOne:GetPlayers()

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			remoteEvent:FireAllClients(player, player.Name)
			local Val = #PlayerAmount
			if Val == 0 then
				wait(4.6)
				Teleport:Teleport(placeID, player)
			end
		end)
	end)
end)

The only difference between team 1 scripts and team 2 scripts is that it addresses different teams when addressing the variables. It is possible that I simply messed up writing one of my scripts or something to do with the test service in roblox studio, idk, just thought it was weird and don’t know why.