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: How come this doesn't work?

Previous Thread :: Next Thread 
SolidWhite is not online. SolidWhite
Joined: 29 Mar 2013
Total Posts: 1086
07 Apr 2015 02:09 PM
I've tested it, it doesn't bring out the map. This is not the full script. I'm scripting this project just for fun. :)

local choices = game.SeverStorage.Maps:GetChildren(math.random(1,1))

if choices == 1 then
local mapname = "OBBY1"
game.ServerStorage.Maps.mapname:Clone().Parent = game.Workspace
wait(5)
Report Abuse
SummerEquinox is not online. SummerEquinox
Joined: 25 Jun 2013
Total Posts: 2088
07 Apr 2015 02:39 PM
*facepalm*

if choices == 1 then
local mapname = "OBBY1"
game.ServerStorage.Maps.mapname:Clone().Parent = game.Workspace
wait(5)
end <
Report Abuse
RelaxRobby is not online. RelaxRobby
Joined: 11 Apr 2011
Total Posts: 104
07 Apr 2015 03:07 PM
Made my day xD
Report Abuse
Haggie125 is not online. Haggie125
Joined: 02 Apr 2008
Total Posts: 761
07 Apr 2015 03:09 PM
Since when does GetChildren() take an arguement? It returns a table of all the items in Maps, so you cant compare a table to 1. If you say #choices, thatll give you the number of items in the table.
Report Abuse
Haggie125 is not online. Haggie125
Joined: 02 Apr 2008
Total Posts: 761
07 Apr 2015 03:11 PM
Also, this line
game.ServerStorage.Maps.mapname:Clone().Parent = game.Workspace
is looking for an item called "mapname" in Maps, not something named mapnames value.

so that should be changed to
game.ServerStorage.Maps:FindFirstChild(mapname):Clone().Parent = game.Workspace
Report Abuse
Seattlantis is not online. Seattlantis
Joined: 24 Jul 2013
Total Posts: 5560
07 Apr 2015 03:11 PM
along with not closing the if statement you created the local variable mapname without using it.

also you should load the map with a function and call the function with an argument to make a system that's easier to work with:

local maps = game.SeverStorage.Maps:GetChildren()

function LoadMap(map)
e = map:Clone()
map.Parent = game.Workspace
map.Name = "OBBY1"
end

LoadMap(maps[math.random(1, #maps)])


-- any maps in the Maps folder are put into a table, then a function randomly selects a map from the table, puts it into Workspace and names it OBBY1.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
07 Apr 2015 03:13 PM
*facesaw*

local maps = game.ServerStorage:WaitForChild("Maps"):GetChildren()

local choice = maps[math.random(#maps)]:Clone()

choice.Parent = game.workspace
choice:MakeJoints()


I script -~ chimmihc
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