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
 

Granting Weapons on Spawn

Previous Thread :: Next Thread 
Bobb1118 is not online. Bobb1118
Joined: 03 Oct 2008
Total Posts: 476
28 Apr 2013 07:18 PM
I'm having trouble giving more than one.
all variables are properly defined

Game.Workspace.ChildAdded:connect(function(new)
player = Game.Players:findFirstChild(new.Name)
if player then
if Weapon.Text == "M4A1" and Mod.Text == "" then
print 'M4A1 Granted'
w = game.Lighting.M4A1:Clone()
w.Parent = player.Backpack
elseif Weapon.Text == "ACR" and Mod.Text == "" then
print 'ACR Granted'
w = game.Lighting.ACR:Clone()
w.Parent = player.Backpack
elseif Weapon.Text == "AK-47" and Mod.Text == "" then
print 'AK-47 Granted'
w = game.Lighting.AK47:Clone()
w.Parent = player.Backpack
else
print 'No primary'
if Weapon2.Text == "RPG-7" and Mod2.Text == "" then
print 'RPG-7 Granted'
w = game.Lighting.RPG7:Clone()
w.Parent = player.Backpack
else
print 'No secondary'
end
end
end
end)

I can have a primary, or the RPG, but not both it seems. Assuming when it finds one from the first list it just ends, how do I stop this?
Report Abuse
phoenix53124 is not online. phoenix53124
Joined: 25 Feb 2009
Total Posts: 4889
28 Apr 2013 07:21 PM
You have to end the first set of 'if' statements after "else print 'no primary'"
Report Abuse
Bobb1118 is not online. Bobb1118
Joined: 03 Oct 2008
Total Posts: 476
28 Apr 2013 07:30 PM
I could have sworn I had this script the exact same way you decribed, but now thats its like that it works. thank you
Report Abuse
Bobb1118 is not online. Bobb1118
Joined: 03 Oct 2008
Total Posts: 476
28 Apr 2013 07:31 PM
now I need to figure out how to grant weapons based on stored table values or something..
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