koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 05:47 AM |
Hello, I need to check the teamcolor of a player.
I got this.
if Players.TeamColor == "Medium stone grey" then
It's not working. :/ No errors.
I tryed too.
if Players.TeamColor == BrickColor.new"Medium stone grey" then |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 05:47 AM |
if Players.TeamColor == BrickColor.new("Medium stone grey") then
That last line.... |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2012 05:49 AM |
Actually, "if Players.TeamColor == BrickColor.new"Medium stone grey" then" would work too. :P
Also, it should work, as long as you compare the brickcolor values. |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
| |
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 06:13 AM |
You propably mean the following:
Players = game.Players:GetPlayers() --OMG THE HOLY :GETPLAYERS() METHOD! Will take all players
for i = 1, #Players do if Players[i].TeamColor == game.Teams:findFirstChild("TEAMNAME").TeamColor then --script stuff here end end |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2012 06:15 AM |
| if player.TeamColor == game.Teams["TeamName"].TeamColor |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:07 AM |
function Respawn(Player) if Player.TeamColor == game.Teams:findFirstChild("Visitors").TeamColor then print'test' Player.Character.MaxHealth = 500 Player.Backpack:ClearAllChildren() end end
Players = game.Players:GetPlayers()
for i = 1, #Players do Players[i].CharacterAdded:connect(Respawn) end
This isn't working? |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 07:09 AM |
function Respawn(Player) if Player.TeamColor == game.Teams:findFirstChild("Visitors").TeamColor then print'test' Player.Character.Humanoid.MaxHealth = 500 --Yes because you forgot Humanoid Player.Backpack:ClearAllChildren() end end
Players = game.Players:GetPlayers()
for i = 1, #Players do Players[i].CharacterAdded:connect(Respawn) end
|
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:10 AM |
Still not working.
It sayd player doesn't exist in the function. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 07:13 AM |
Oh ya. Better you do the following:
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function Respawn(Character) if Player.TeamColor == game.Teams:findFirstChild("Visitors").TeamColor then print("test") Character.Humanoid.MaxHealth = 500 Player.Backpack:ClearAllChildren() end end) end) |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:20 AM |
| Still not working without error. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 07:21 AM |
| Maybe, because when spawned it's not in the Visitors team? |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:26 AM |
I ckecked it.
He's in visitor team.
The way I tested.
Tools -> Test -> Start Server Tools -> Test -> Start Player
Idk if it matters. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 07:31 AM |
Tell me the output of the following:
game.Players.PlayerAdded:connect(function(Player) print("Player " ..Player.Name.. " added.") Player.CharacterAdded:connect(function Respawn(Character) print("Character of " ..Character.Name.. " spawned.") if Player.TeamColor == game.Teams:findFirstChild("Visitors").TeamColor then print("Player " ..Player.Name.. " is in Team Visitors.") Character.Humanoid.MaxHealth = 500 print("Health added to " ..Character.Name) Player.Backpack:ClearAllChildren() print("Removed all tools and hopperbins of " ..Player.Name) else print("Player " ..Player.Name.. " is not in Team Visitors.") end end) end) |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:34 AM |
I will test this one too.
Ingame output says Script:2:")" expected near respawn.
So ) is expected near respawn at line 2. |
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 08 Aug 2012 07:36 AM |
I got the problem. I had to remove Respawn.
Thanks for helping me. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 07:38 AM |
| Idk why I wrote Respawn there. Maybe because of the older script here. :/ |
|
|
| Report Abuse |
|
|