The function to change the team runs, yet nothing happens to the player’s team.
local pl = game:GetService('Players')
local teams = game:GetService('Teams')
local spectateTeam = teams.Spectator
pl.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
character.Humanoid.Died:Connect(function()
player.Team = spectateTeam
end)
--This is the function with issues
game.ReplicatedStorage.LavaEventServer.OnServerEvent:Connect(function(player)
print("---------Player Function Ran---------")
game.Players:GetChildren().Team = teams.Player
end)
end)