Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Team change on death?

When a player dies , the players team is switched. (Die on Dark blue switch to Really red) There are only two teams. First team - "Dark blue" (Colour of the team). Second team - "Really red".

player = game.Players.LocalPlayer

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
		
         if player.TeamColor.BrickColor.Name == ("Dark blue") then
	player.TeamColor.BrickColor.Name = ("Really red")
else
	player.TeamColor.BrickColor.Name = ("Dark blue")
end

I feel like the 3rd to 5th line has an error but just can spot it.

2 comments

0

is there an error in the output?

0

Yes "Workspace.Team change when die.:13: Expected 'end' (to close 'function' at line 3), got "

2 answers

Is this the full script? Since i didnt see "end"s for those function

Also you only need these to change team

player.TeamColor = --Team color name here

2 comments

0

TeamColor is a BrickColor, not a string

0

oop my bad

First of all, Don't do BrickColor.Name, it is just BrickColor

if you want to do that then do:

if plr.Team == game.Teams.TeamName then --type code here end

I hope this helps :D

This discussion is preserved as it was. New answers, comments, and votes are closed.