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 » Scripters
Home Search
 

Re: Can anyone fix this script?

Previous Thread :: Next Thread 
KingDoodleBob is not online. KingDoodleBob
Joined: 05 Aug 2009
Total Posts: 14092
22 Sep 2015 05:17 PM
players=game.Players:GetPlayers()
local pshooter=players[math.random(1,#players)]
if players.NumPlayers > 0 and players.NumPlayers < 7 then
pshooter = 1
elseif players.NumPlayers > 6 and players.NumPlayers < 12 then
pshooter = 2
elseif players.NumPlayers > 11 and players.NumPlayers < 16 then
pshooter = 3
elseif players.NumPlayers > 15 and players.NumPlayers < 26 then
pshooter = 4
elseif players.NumPlayers > 25 then
pshooter = 5
end


I think it has something to do with math.random?
Report Abuse
Rocketerkid is not online. Rocketerkid
Joined: 10 Oct 2011
Total Posts: 1237
22 Sep 2015 05:30 PM
You're trying to call NumPlayer on an array. You call it on game.Players.
Report Abuse
KingDoodleBob is not online. KingDoodleBob
Joined: 05 Aug 2009
Total Posts: 14092
23 Sep 2015 05:46 PM
so rocket what would I switch it with?
Report Abuse
haydebug2003 is not online. haydebug2003
Joined: 21 Jan 2012
Total Posts: 5302
23 Sep 2015 05:47 PM
#code players=game.Players
local x = players:GetChildren()
local pshooter=x[math.random(1,#x)]
if players.NumPlayers > 0 and players.NumPlayers < 7 then
pshooter = 1
elseif players.NumPlayers > 6 and players.NumPlayers < 12 then
pshooter = 2
elseif players.NumPlayers > 11 and players.NumPlayers < 16 then
pshooter = 3
elseif players.NumPlayers > 15 and players.NumPlayers < 26 then
pshooter = 4
elseif players.NumPlayers > 25 then
pshooter = 5
end

That should work fine now.


#code Instance.new("haydebug2003",game.ROBLOX.Forums)
Report Abuse
KingDoodleBob is not online. KingDoodleBob
Joined: 05 Aug 2009
Total Posts: 14092
23 Sep 2015 05:54 PM
Didn't work :(

Of course I got rid of #code
Report Abuse
KingDoodleBob is not online. KingDoodleBob
Joined: 05 Aug 2009
Total Posts: 14092
23 Sep 2015 05:56 PM
when you realize, it's shooterp not pshooter

failssss
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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