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: Assigning Weapons To Random Characters

Previous Thread :: Next Thread 
MysteryMilo is not online. MysteryMilo
Joined: 13 Aug 2010
Total Posts: 175
16 Dec 2013 09:47 PM
I'd like a script that picks a random player from the game, then gives them [weapon1]. Then gives all the other players [weapon2]. I've been trying to code this for two days, and I'm getting nowhere. Help is appreciated.
Report Abuse
InfiniteVelocity is not online. InfiniteVelocity
Joined: 02 Dec 2013
Total Posts: 38
16 Dec 2013 09:48 PM
Your attempt at the script is required for my help or many of the others on this forum.
Report Abuse
MysteryMilo is not online. MysteryMilo
Joined: 13 Aug 2010
Total Posts: 175
16 Dec 2013 10:07 PM
playing = {}
assassin = {}
p = game.Players:GetPlayers()
for i=1,#p do
if p[i].Character ~= nil then
if p[i].Character:findFirstChild("Spectate") == nil then
table.insert(playing, p[i])
end
end
end
num = math.random(1,#playing)
assassin = playing[num]
wait()
wep = game.Lighting.Assassin
wep:Clone().Parent = assassin.Backpack
end
for i=1,#p do
if p[i].Character ~= nil then
if p[i].Character:findFirstChild("Spectate") == nil and p[i].Name ~= assassin.Name then
wep = game.Lighting.Officer
wep:Clone().Parent = p[i].Backpack
end
end
Report Abuse
MysticPing is not online. MysticPing
Joined: 09 Apr 2010
Total Posts: 258
17 Dec 2013 12:27 AM
i would do like this:

players = {
1,
2,
3,
4,
5,
6,
}

chosen=math.random(1,#players)
players[chosen]=assassin
--stuff that gives assassin his stuff

for i,v in ipairs(players)
if players[i] ~= assassin then
-- give player weapon
end
Report Abuse
MysticPing is not online. MysticPing
Joined: 09 Apr 2010
Total Posts: 258
18 Dec 2013 12:54 AM
did this help?
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