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: Possibly the easiest script ever, and it's not working. >_>

Previous Thread :: Next Thread 
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
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 is not online. 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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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 is not online. acealeam
Joined: 16 Oct 2009
Total Posts: 14875
21 Dec 2010 07:33 PM
player[i].Teamcolor = "Really black"

Try that.
Report Abuse
Spectrumw is not online. 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 is not online. 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 is not online. 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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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 is not online. 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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
21 Dec 2010 07:37 PM
Black is a valid BrickColor, it's the color that the standard base starts as.
Report Abuse
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
21 Dec 2010 07:38 PM
Black is a valid color.
Report Abuse
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
21 Dec 2010 07:39 PM
Lemme test out the new script, brb.
Report Abuse
Spectrumw is not online. 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
ColonelGraff is not online. ColonelGraff
Joined: 28 Sep 2008
Total Posts: 2457
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 is not online. 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 is not online. 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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
21 Dec 2010 07:43 PM
Well, the new script isn't working, so I think it might.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
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
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
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
goodnamesalltaken is not online. goodnamesalltaken
Joined: 20 Mar 2010
Total Posts: 19799
21 Dec 2010 07:54 PM
YESH!
It be working.
Thanks everyone :)
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