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 » Scripters
Home Search
 

Re: Minigame Script Issue

Previous Thread :: Next Thread 
LuckyArmy11 is not online. LuckyArmy11
Joined: 08 Aug 2015
Total Posts: 57
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
LuckyArmy11 is not online. LuckyArmy11
Joined: 08 Aug 2015
Total Posts: 57
01 Dec 2016 02:59 PM
Ahhhh, well dang... lol.
Thanks. :)
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