generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Team Check

Previous Thread :: Next Thread 
koen500 is not online. 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 is not online. 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
jAlternate is not online. jAlternate
Joined: 02 Dec 2011
Total Posts: 234
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 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
08 Aug 2012 06:10 AM
They both wont work.
Report Abuse
Cheater is not online. 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
luke111000 is not online. luke111000
Joined: 26 Apr 2009
Total Posts: 1853
08 Aug 2012 06:15 AM
if player.TeamColor == game.Teams["TeamName"].TeamColor
Report Abuse
koen500 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
08 Aug 2012 07:20 AM
Still not working without error.
Report Abuse
Cheater is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image