|
| 21 Dec 2010 07:31 PM |
local players = game.Players:GetPlayers()
function onPlayerEntered(newPlayer) for i=1,#players do
if (players[i]:IsInGroup(43242) == true) then player[i].Teamcolor.New = Black end end end game.Players.PlayerAdded:connect(onPlayerEntered)
Halp pl0x? Output is clear, no problem's I've seen other than the fact that it doesn't work. |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2010 07:32 PM |
function onPlayerEntered(newPlayer) if (newPlayer:IsInGroup(43242)) then newPlayer.Teamcolor.New = Black end end game.Players.PlayerAdded:connect(onPlayerEntered)
|
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:33 PM |
local players = game.Players:GetPlayers()
Since you're doing that immediately when the server starts, that means there's no players yet, so basically, this is what you're saying:
local players = { }
Also, why would you need to loop through all of the players? Can't you just check each player as they enter the game? |
|
|
| Report Abuse |
|
|
acealeam
|
  |
| Joined: 16 Oct 2009 |
| Total Posts: 14875 |
|
|
| 21 Dec 2010 07:33 PM |
player[i].Teamcolor = "Really black"
Try that.
|
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2010 07:33 PM |
| And just by the way, your mistake is that you created the player's table (With the GetChildren method) at the very start, when no one was in the game. |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2010 07:34 PM |
I failed D:
function onPlayerEntered(newPlayer) if (newPlayer:IsInGroup(43242)) then newPlayer.Teamcolor = BrickColor.new("Really black") end end game.Players.PlayerAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
acealeam
|
  |
| Joined: 16 Oct 2009 |
| Total Posts: 14875 |
|
|
| 21 Dec 2010 07:34 PM |
How did I not see that!? Her-Dee der! |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:35 PM |
Oh yeah, the teamcolor thing...
PLAYERTHINGY.TeamColor = BrickColor.new("Black")
TeamColor is a property in each player, and its value is a BrickColor. Since you don't already have the BrickColor from somewhere else, you have to create a new BrickColor, so you say BrickColor.new. |
|
|
| Report Abuse |
|
|
acealeam
|
  |
| Joined: 16 Oct 2009 |
| Total Posts: 14875 |
|
|
| 21 Dec 2010 07:37 PM |
PLAYERTHINGY.TeamColor = BrickColor.new("Really black") --Black is a nil value |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:37 PM |
| Black is a valid BrickColor, it's the color that the standard base starts as. |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Dec 2010 07:39 PM |
| Lemme test out the new script, brb. |
|
|
| Report Abuse |
|
|
Spectrumw
|
  |
| Joined: 04 Aug 2009 |
| Total Posts: 13510 |
|
|
| 21 Dec 2010 07:39 PM |
He meant 'Black' in the original script, he told it like it was a variable. P.S: Check my freaking pseudo click detector D: *Kicks* |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:40 PM |
| Dont you have to do player.userID:IsInGroup() or does the function get a player's ID automatically? |
|
|
| Report Abuse |
|
|
acealeam
|
  |
| Joined: 16 Oct 2009 |
| Total Posts: 14875 |
|
|
| 21 Dec 2010 07:40 PM |
| :O Maybe I should just drink some warm milk and take a nap... |
|
|
| Report Abuse |
|
|
acealeam
|
  |
| Joined: 16 Oct 2009 |
| Total Posts: 14875 |
|
|
| 21 Dec 2010 07:41 PM |
| Clonel, I think it doesn't need the playerId but after me being wrong so many times on this thread, it probably does. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:41 PM |
| @Colonel: IsInGroup is a member of the Player object, not the datatype number, which is what userId is. It's a number. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:43 PM |
| Well, the new script isn't working, so I think it might. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:44 PM |
function onPlayerEntered(newPlayer) if newPlayer:IsInGroup(43242) then newPlayer.TeamColor = BrickColor.new("Black") end end game.Players.PlayerAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:46 PM |
I think I just figured it out. Don't I need to include the:
else then end
In case they're not in the group? May be wrong, it's been a while since I've scripted for my clan (Been playing other games) |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:48 PM |
| Nope. That would be superfluous, and 'else' doesn't need a 'then', so it would break your script. |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2010 07:54 PM |
YESH! It be working. Thanks everyone :) |
|
|
| Report Abuse |
|
|