I am making a round based game, and I have two teams: Lobby and Game. They should be pretty self explanatory. So anyways, I have a LocalScript placed under StarterGui that is supposed to change the player’s team on death, but it does not.
I’m pretty sure the problem is function(___). I’m not sure which object’s perspective it’s coming from, and I’ve tried the player, character, and humanoid.
Can you help me write a functional script that changes the player’s team on death? If possible, let me know in a post!
You should never try to change team on the client side (local script). You should also provide your current code so people can help you on identifying and solving the problem.
You could make a script in server script service like this.
Player.CharacterAdded:connect(function(Character)
repeat wait() until Character:FindFirstChild("Humanoid") ~= nil
Character.Humanoid.Died:connect(function()
if Player.TeamColor == game.Teams.Game.TeamColor then
Player.TeamColor = game.Teams.Lobby.TeamColor
end
end)
end)
end)
This will change the player’s team to Lobby when they die.
Hope it helps you out.