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: I Need a Randomizer Script

Previous Thread :: Next Thread 
SoManyNarwhals is not online. SoManyNarwhals
Joined: 08 Jul 2009
Total Posts: 656
22 Oct 2014 03:36 AM
To be more specific, I need a script that selects a random Player to receive a special weapon, and have the ability to kill the other players. A good example would be Darkness, the Mad Murderer, or Insanity. The only way I could think of giving the randomly selected Player the ability to kill the others is if it puts him/her in a separate team. However, if you could find a way to work around that, that would be nice, as I don't want the name of the randomly selected Player to be displayed on the Leaderboard.
Report Abuse
Ortron is not online. Ortron
Joined: 19 Jul 2013
Total Posts: 1297
22 Oct 2014 04:24 AM
Try this, (may be wrong)



players=game.PlayersNumPlayers

ChosenOne=math.random(1,#players)

print(ChosenOne, "has been chosen.")
Report Abuse
Ortron is not online. Ortron
Joined: 19 Jul 2013
Total Posts: 1297
22 Oct 2014 04:25 AM
"players=game.PlayersNumPlayers"

players=game.Players.NumPlayers*
Report Abuse
thermonuklear is not online. thermonuklear
Joined: 19 Oct 2014
Total Posts: 484
22 Oct 2014 04:28 AM
plrs = game.Players.NumPlayers
chosen = math.random(1,#plrs)
weapon = game.ServerStorage.LinkedSword -- change this
weapon:clone().Parent = chosen.Backpack



Report Abuse
SoManyNarwhals is not online. SoManyNarwhals
Joined: 08 Jul 2009
Total Posts: 656
22 Oct 2014 04:46 AM
Thank you! Would I put the Script in Workspace or StarterGui? And how would I make it so this randomizer is round-based? So that once the player is selected, there will be a certain interval (in this interval, the game will be in-progress), and once the game ends, it selects a new one? Would I just have to do wait(however long I want each round to be)?
Report Abuse
Ortron is not online. Ortron
Joined: 19 Jul 2013
Total Posts: 1297
22 Oct 2014 05:58 AM
The script can be placed in either and to have an interval try this

while true do
h=Instance.new("Hint",game,Workspace)
h.Text="Round starting in"

for timer=1,30,-1 do
H.Text="Round will begin in ", timer," seconds."
wait(1)
end


(Randomise script here)




end
Report Abuse
thekoolguy1010 is not online. thekoolguy1010
Joined: 10 Sep 2011
Total Posts: 2623
22 Oct 2014 07:16 AM
Use math.random, for instance:

local wep = game:GetService("ServerStorage"):WaitForChild("YOURWEPHERE")
local playerserv = game:GetService("Players")
local playing = playerserv.NumPlayers
local chooseplr = math.random(1,#playing)
wep:clone().Parent = chooseplr.Backpack
Report Abuse
SoManyNarwhals is not online. SoManyNarwhals
Joined: 08 Jul 2009
Total Posts: 656
22 Oct 2014 04:19 PM
Thank you guys! The Randomizer script is one of the only things that has been holding me back from finishing my game. That, and getting the first map done.
Report Abuse
EliteDerper is not online. EliteDerper
Joined: 05 Feb 2012
Total Posts: 2288
22 Oct 2014 04:20 PM
None of them will work, math.random() isn't random, it will give the same results in a other server.
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