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 |
|
|
|
| 25 May 2017 06:52 PM |
for _,v in pairs(weaponFolder) do v:Clone().Parent = player.Backpack
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 25 May 2017 10:27 PM |
You have no idea what you're doing, do you.
|
|
|
| Report Abuse |
|
|
JamSnack
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 154 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 26 May 2017 10:36 AM |
| Not sure what you are asking but I think what you seek is this: ################################################################### |
|
|
| Report Abuse |
|
|
JamSnack
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 154 |
|
| |
|
|
| 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
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 154 |
|
| |
|