Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with my team change script?

Asked by 10 years ago

This script was used for my team change when dead.

game.Players.PlayerAdded:connect(function(plr)
plr.Neutral = false
plr.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()

if plr.TeamColor ==  BrickColor.new("Bright red") then
plr.TeamColor =  BrickColor.new("Bright Blue")
else
plr.TeamColor = BrickColor.new("Bright red")
end
end)


end)


end)

The problem is, whenever you die. It creates a new team called "Neutral" when they die. Does anyone know the problem?

1 answer

Log in to vote
0
Answered by
RM0d 305 Moderation Voter
10 years ago

Team1 = game.Teams.Red Team2= game.Teams.Blue game.Players.PlayerAdded:connect(function(plr) plr.Neutral = false plr.CharacterAdded:connect(function(character) plr.Neutral = false character:WaitForChild("Humanoid").Died:connect(function() if plr.TeamColor == Team1 .TeamColor then plr.TeamColor = Team2.TeamColor else plr.TeamColor = Team1.TeamColor end end) end) end)

everytime player spawns set there Neutral edit: if team Dosent exist then it will be set to Neutral If code dosent work COmment below

0
It still creates a team called "Neutral". FamousDoge 0 — 10y
0
I will look into it RM0d 305 — 10y
0
Two teams exist. Red & Blue. I want them to change to blue when they die. But it creates a team called "Neutral" when a player dies. FamousDoge 0 — 10y
0
I updated the script make sure ur teams are called Red and Blue unless you change line 1 and 2 RM0d 305 — 10y
View all comments (5 more)
0
Red Team & Blue Team? Or just Red & Blue? FamousDoge 0 — 10y
0
Just Red and JUst Blue RM0d 305 — 10y
0
Okay, thanks! It worked :D One up. FamousDoge 0 — 10y
0
you change the names by changing line 1 and line 2 at the end RM0d 305 — 10y
0
and upvote me please RM0d 305 — 10y
Ad

Answer this question