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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to equip a weapon before the round starts?

Previous Thread :: Next Thread 
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
25 May 2017 06:02 PM
How would I make a player able to equip a weapon before the round starts and then give the weapon to that player when the round starts? Here is some code that correlates to giving the weapons to the player when the round starts. (this code gives the player every weapon in the "weaponManagement" folder)

local mapsinserverstorage = game:GetService("ServerStorage"):GetChildren()
local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)]
ch######################## mapstorage
status.Value = "Get ready to fight!"
wait(3)
local spawns = chosenmap:WaitForChild("Spawns"):GetChildren()
for _, player in pairs (game.Players:GetPlayers()) do
if player and #spawns > 0 then
local torso = player.Character:WaitForChild("Torso")
local allspawns = math.random(1, #spawns)
local randomspawn = spawns[allspawns]
if randomspawn and torso then
table.remove (spawns, allspawns)
torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))


local weaponFolder = game.ReplicatedStorage:WaitForChild("weaponManagement"):GetChildren()
for _, v in pairs(weaponFolder) do
local myClone = v:Clone() --using clone() returns the actual cloned model.
myClone.Parent = player.Backpack
end
end
end
end
Report Abuse
ForceCyber is not online. ForceCyber
Joined: 06 May 2015
Total Posts: 1086
25 May 2017 06:52 PM
for _,v in pairs(weaponFolder) do
v:Clone().Parent = player.Backpack


Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
25 May 2017 10:08 PM
I am not sure what you are trying to tell me with that bit of code.
Report Abuse
jody7777 is not online. jody7777
Joined: 22 Feb 2009
Total Posts: 1343
25 May 2017 10:27 PM
you put the weapon directly in their character model


FOR THE CAUSE
Report Abuse
InfiniteYield is online. InfiniteYield
Joined: 01 Mar 2012
Total Posts: 762
25 May 2017 10:27 PM
You have no idea what you're doing, do you.



Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
26 May 2017 10:22 AM
Indeed.
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
26 May 2017 10:28 AM
FOR THE CAUSE

So when a player "equips" a weapon I put a clone of it in their character model, so it doesn't equip in the backpack, and when the round starts I find that item and change its parent to the players backpack?
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
26 May 2017 10:34 AM
So is there a way I could put a folder in each player called "Equipped", I would use this to reference the weapon that is to be equipped.
Report Abuse
ScripterJohn13 is not online. ScripterJohn13
Joined: 01 Jan 2010
Total Posts: 5658
26 May 2017 10:36 AM
Not sure what you are asking but I think what you seek is this: ###################################################################
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
26 May 2017 10:37 AM
oh
Report Abuse
ScripterJohn13 is not online. ScripterJohn13
Joined: 01 Jan 2010
Total Posts: 5658
26 May 2017 10:37 AM

Wow roblox filtering has improved... Now they filter even their own website links... Geez roblox what ingenious person is responsible for that?

Anyways check roblox wiki > Humanoid > :EquipTool(ToolGoesHere)
Report Abuse
JamSnack is not online. JamSnack
Joined: 04 Aug 2011
Total Posts: 154
26 May 2017 10:38 AM
okay
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