|
| 01 Dec 2016 02:43 PM |
The script below is a function where I will be randomly picking minigame, but then want a weapon to spawn in with selected minigames... Any help would be nice.
function GetMap() local Maps = game.ReplicatedStorage.Maps:GetChildren() local PickMap = math.random(1, #Maps) local SelectedMap = Maps[PickMap]:Clone() SelectedMap.Name = 'Maps' SelectedMap.Parent = game.Workspace if SelectedMap.Name == "M1" then game.Lighting.Sword:clone().Parent = Players[i].Backpack -- change "Sword" to the name of the weapon you want players to have during the minigame. remember! put the weapon in Lighting. end end
|
|
|
| Report Abuse |
|
|
Mr_Code
|
  |
| Joined: 19 Oct 2011 |
| Total Posts: 135 |
|
|
| 01 Dec 2016 02:45 PM |
function GetMap() local Maps = game.ReplicatedStorage.Maps:GetChildren() local PickMap = math.random(1, #Maps) local SelectedMap = Maps[PickMap]:Clone() SelectedMap.Name = 'Maps' SelectedMap.Parent = game.Workspace if SelectedMap.Name == "M1" then local p = game.Players:GetChildren() for i=1,#p do game.Lighting.Sword:clone().Parent = p[i].Backpack -- change "Sword" to the name of the weapon you want players to have during the minigame. remember! put the weapon in Lighting. end end end
print(RBLX.Forums.Scripters:FindFirstChild("Knowledge").Value)) [ERROR] Attempt to index a nil value |
|
|
| Report Abuse |
|
|
Mr_Code
|
  |
| Joined: 19 Oct 2011 |
| Total Posts: 135 |
|
|
| 01 Dec 2016 02:45 PM |
You just needed to use a for statement to iterate through all of the players in the game
print(RBLX.Forums.Scripters:FindFirstChild("Knowledge").Value)) [ERROR] Attempt to index a nil value |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 01 Dec 2016 02:50 PM |
That must be an older free model script.
1) Don't use free model scripts
2) Don't use Lighting for storage
Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil) |
|
|
| Report Abuse |
|
|
Mr_Code
|
  |
| Joined: 19 Oct 2011 |
| Total Posts: 135 |
|
|
| 01 Dec 2016 02:52 PM |
I noticed that as well, but I decided it wasn't worth it to try to get him to switch it, he would probably just mess it up, and it will technically still work in lighting like he's doing rn.
btw nice sig :P
print(RBLX.Forums.Scripters:FindFirstChild("Knowledge").Value)) [ERROR] Attempt to index a nil value |
|
|
| Report Abuse |
|
|
|
| 01 Dec 2016 02:59 PM |
Ahhhh, well dang... lol. Thanks. :) |
|
|
| Report Abuse |
|
|