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: Unsure about where to place this script

Previous Thread :: Next Thread 
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 07:59 PM
local replicatedStorage = game:GetService("ReplicatedStorage")
local maps = replicatedStorage:WaitForChild("Maps")

function pickMap()
local mapList = maps:GetChildren() -- Declares a table of the maps inside of the Maps folder.
local selectedIndex = math.random(1,#maps) -- Choose a random number between 1, and the number of maps available.
local map = mapList[selectedIndex]:Clone() -- Create a clone of the map we selected.
map.Parent = workspace -- Parent it to the workspace.
map.Name = "Map" -- Rename the map so that we can use the unloadMap() function later to remove it.
return mapList[selectedIndex].Name -- Return the name of the map we selected, in case we want to display it.
end

function unloadMap()
if workspace:FindFirstChild("Map") then -- If there is a model in the Workspace named "Map"
workspace.Map:Destroy() -- Destroy it!
end
end

local h = Instance.new("Hint")
h.Parent = workspace

while true do
h.Text = "Picking new map..."
wait(3)
local mapName = selectMap()
h.Text = "Selected map: "..mapName
wait(3)
h.Text = "Unloading map..."
unloadMap()
wait(3)
end

-----------------------------------------------------

i put this in a local script - but where do i put it in my game so it will actually pick a map i have in my map folder

note: this is a script on the wiki page - im using it til i am fluent in scripting (starting to learn)



-zaxzacnv1
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 08:03 PM
rip


-zaxzacnv1
Report Abuse
LightFantom is online. LightFantom
Joined: 23 Sep 2014
Total Posts: 7830
01 Feb 2017 08:04 PM
Server script services?


Love breeds sacrifice... which in turn breeds hatred. Then you can know pain.
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 08:06 PM
@Light - It didn't work?

I have all my maps in a folder named "maps"

and then 2 maps in that folder - each having their own custom name?


-zaxzacnv1
Report Abuse
LightFantom is online. LightFantom
Joined: 23 Sep 2014
Total Posts: 7830
01 Feb 2017 08:09 PM
Huh idk then, I put all my script there and it works just fine...


Love breeds sacrifice... which in turn breeds hatred. Then you can know pain.
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 08:16 PM
I mean this one wants to pull a map out of replicated storage - then delete it once the round is over - but i cant get it to work :(


-zaxzacnv1
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 08:20 PM
bump


-zaxzacnv1
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 08:48 PM
qq


-zaxzacnv1
Report Abuse
xDarkScripter is not online. xDarkScripter
Joined: 31 Jul 2015
Total Posts: 149
01 Feb 2017 09:03 PM
Try putting this at the top of your script:

setfenv(1, {})

That outa do it
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 09:18 PM
@Dark, under which thing should I put it under?

like the script itself do i put it in workspace or???


-zaxzacnv1
Report Abuse
HalfPinky456 is not online. HalfPinky456
Joined: 10 Apr 2011
Total Posts: 6236
01 Feb 2017 09:22 PM
ignore dark, he's trying to be a funny troll
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 09:24 PM
Oh.


-zaxzacnv1
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
01 Feb 2017 10:35 PM
;(


-zaxzacnv1
Report Abuse
Wrathoxic is not online. Wrathoxic
Joined: 29 May 2013
Total Posts: 1950
02 Feb 2017 05:45 AM
local replicatedStorage = game:GetService("ReplicatedStorage")
local maps = game.ServerStorage:WaitForChild("Maps")

function pickMap()
local mapList = maps:GetChildren() -- Declares a table of the maps inside of the Maps folder.
local selectedIndex = math.random(1,#maps) -- Choose a random number between 1, and the number of maps available.
local map = mapList[selectedIndex]:Clone() -- Create a clone of the map we selected.
map.Parent = workspace -- Parent it to the workspace.
map.Name = "Map" -- Rename the map so that we can use the unloadMap() function later to remove it.
return mapList[selectedIndex].Name -- Return the name of the map we selected, in case we want to display it.
end

function unloadMap()
if workspace:FindFirstChild("Map") then -- If there is a model in the Workspace named "Map"
workspace.Map:Destroy() -- Destroy it!
end
end

local h = Instance.new("Hint")
h.Parent = workspace

while true do
h.Text = "Picking new map..."
wait(3)
local mapName = selectMap()
h.Text = "Selected map: "..mapName
wait(3)
h.Text = "Unloading map..."
unloadMap()
wait(3)
end

Put this script in ServerScriptService, the maps folder in ServerStorage.


Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
02 Feb 2017 05:47 AM
You are calling a function that does not exist.

Change selectmap() to pickmap()
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
06 Feb 2017 07:19 PM
Still confused...


-zaxzacnv1
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
06 Feb 2017 07:22 PM
put it in the trash with all the free models
Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
06 Feb 2017 07:28 PM
@XCVIII, What free models? Did you even visit the game? The only thing that's # free model is the couch and stuff in the shop. that aint staying i just needed something to fill the space to remind me what i was putting there lmao -zaxzacnv1
Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
06 Feb 2017 07:32 PM
In your brain.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
06 Feb 2017 07:35 PM
If you want to learn how to make a minigame then go here and click on the "edit" button.

https://www.roblox.com/games/141589692/Basic-Minigame


Report Abuse
Clothing_Maker is not online. Clothing_Maker
Joined: 01 Mar 2016
Total Posts: 3265
06 Feb 2017 07:37 PM
Thanks @TimeTicks


-zaxzacnv1
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