So it works first time when the player dies. But when it dies twice the for loop doesn't work.
if winner == "Team DeathMatch" then
local player = game:GetService("Players").LocalPlayer
local allplrs = game:GetService("Players"):GetPlayers()
for _,v in pairs(allplrs) do
local h = v.Character:FindFirstChild("Humanoid")
h.Died:Connect(function()
local red_cf = CFrame.new(28.859, 8.588, 104.769)
local blue_cf = CFrame.new(-148.635, 8.115, 104.769)
warn("someone ded")
local function o()
return v.team.Value
end
warn("work here i guesss")
local x = o()
if x == "blue" then
warn("hi")
v:LoadCharacter()
v.Character:SetPrimaryPartCFrame(blue_cf)
game.ReplicatedStorage.remotes.tdstuff:FireClient(v)
elseif x == "red" then
warn("hi")
v:LoadCharacter()
v.Character:SetPrimaryPartCFrame(red_cf)
game.ReplicatedStorage.remotes.tdstuff:FireClient(v)
end
end)
end
wait(150)
for i,plr in pairs(game.Players:GetPlayers()) do
plr:LoadCharacter()
end
end
```