tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 12:39 AM |
while true do wait() --you need this, otherwise roblox will crash
function MapSelector (Lighting, Workspace) a = math.random (1,3) if a == 1 then local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Havoc") -- Upcoming Map Name wait(4) msg:remove() game.Lighting.Map1:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map1:remove() game.Lighting.FogEnd = 100000 -- removes fog from map wait (1) else if a == 2 then local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Desert Troop") -- Upcoming Map Name wait(4) msg:remove() game.Lighting.Map2:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map2:remove() wait (1) else if a == 3 then local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Harbor") -- Upcoming Map Name wait(4) msg:remove() game.Lighting.Map3:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map3:remove() wait (1) end end end end end
I know I am missing something and it's probably obvious. I want my script to scroll through these maps at random(for now) and it doesn't even select a map in the first place. Ignore the fact that I have the maps on for 20 seconds each that is for testing purposes. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2014 12:41 AM |
| Are you executing the function MapSelector()?. |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 11:32 AM |
| Well it isn't on disabled so I have no idea, I'm a beginner scripter |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 06 Jul 2014 11:33 AM |
| ah the days i was so inefficient |
|
|
| Report Abuse |
|
|
NiceCoder
|
  |
| Joined: 15 Oct 2012 |
| Total Posts: 6593 |
|
|
| 06 Jul 2014 11:37 AM |
| this isnt even ur script lol |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2014 11:43 AM |
This script is not a very good script because it will be hard to add maps in the future. So I am not going to show you the error, but re-write the script.
local maps={game.Lighting:findFirstChild("Harbor"), game.Lighting:findFirstChild("Desert Troop")} --You add more local map
chooseMap=function() local seed=math.random(1, #maps) local map=maps[seed] return (map) end
notifyMapLoad=function(mapName) local msg=Instance.new("Message", workspace) msg.Parent=Workspace msg.Text=("Loading Map:" mapName) game.Debris:AddItem(msg, 4) end
spawnMap=function(map) local clone=map:Clone() clone.Parent=workspace notifyMapLoad(clone.Name) end
removeMap=function(map) map:remove() end
while (true) do wait() map=chooseMap() spawnMap(map) wait(50) removeMap(map) end |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2014 11:44 AM |
| Sorry for any errors/typos, I wrote this directly on the forum. Good luck ;) |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 06 Jul 2014 11:45 AM |
game.ServerStorage:findFirstChild("Map"..map)
... |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2014 11:46 AM |
| Well I'm sorry, I learned before roblox added that. |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 03:53 PM |
| @Nice coder, this is my script the script I had before was linear and spawned the maps in order, I rewrote it to have the maps be random, but thank you for being rude, go somewhere else if you're going to be toxic and judgmental |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 03:54 PM |
| The maps are actually named Map1 Map2 Map3 inside lighting cause it was easier to line them up originally that way. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 06 Jul 2014 03:58 PM |
You don't need an if statement checking the number.
My map chooser doesn't have any if statements. |
|
|
| Report Abuse |
|
|
|
| 06 Jul 2014 04:00 PM |
> inside lighting Roblox is moving away from storing things in lighting. Store things in ServerStorage.
I hate the LGBT. Those laser guided battle tanks are just too damn powerful. |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 04:01 PM |
| That signature (thumbs up) |
|
|
| Report Abuse |
|
|
| |
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
| |
|
|
| 06 Jul 2014 05:32 PM |
| Did my script work for you? |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 07:04 PM |
So smiley essentially you are saying this is what it should look like function MapSelector (ServerStorage, Workspace) a = math.random (1,3)
a = 1 local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Havoc") -- Upcoming Map Name wait(4) msg:remove() game.ServerStorage.Map1:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map1:remove() game.Lighting.FogEnd = 100000 -- removes fog from map wait (1)
a = 2 local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Desert Troop") -- Upcoming Map Name wait(4) msg:remove() game.ServerStorage.Map2:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map2:remove() wait (1)
a = 3 local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: Harbor") -- Upcoming Map Name wait(4) msg:remove() game.ServerStorage.Map3:clone().Parent = game.Workspace wait(20) -- Time between map changes wait(4) game.Workspace.Map3:remove() wait (1)
end end
And if so how does it know if a selected 1,2,3 without the if statements being there, it sounds like you want me to load all 3 maps at once. |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 07:36 PM |
| Airsoft I will try your script out but I prefer to use my own, if it works I will let you know if not and I can fix it I will fix it and post it here. :) |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 06 Jul 2014 07:43 PM |
| Your script doesn't work, nor do I have any knowledge of scripting that could help you, my scripts are big and sloppy the way I like them and understand them. :) |
|
|
| Report Abuse |
|
|
fajner1
|
  |
| Joined: 30 Mar 2008 |
| Total Posts: 77 |
|
|
| 06 Jul 2014 08:18 PM |
Big, sloppy, linear scripts are often easier to make when diving right in, but if you try to convert the major part into a function, it might help you find the error (not to mention improve expandability). The three large blocks of code are identical to each other except for the name and location of the map. If you wanted to change the wait times, for example, you would have to go into each blocks and change them, but if you turn it into a function, you only have to do it once.
/*
function nextMap(mapName, mapLocation) print("[Debug] Map "..mapName.." loaded") local msg = Instance.new("Message") msg.Parent = game.Workspace msg.Text = ("Loading Map: "..mapName) -- Upcoming Map Name wait(4) msg:remove() local map = mapLocation:clone() map.Parent = game.Workspace wait(24) -- Time between map changes map:remove() game.Lighting.FogEnd = 100000 -- removes fog from map wait (1) end
while true do wait() local choice = math.random(1,3) if choice == 1 then nextMap("Havoc", game.ServerStorage.Map1) elseif choice == 2 then nextMap("Desert Troop", game.ServerStorage.Map2) elseif choice == 3 then nextMap("Harbor", game.ServerStorage.Map3) end end
*/ |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 07 Jul 2014 12:01 AM |
| It didn't work, no error it just never selected a map in the first place. Maybe if I give you my original map script and we just tweak it to randomly select a map instead of trying to make a new script. |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 07 Jul 2014 12:44 AM |
| Ignore that your script did work but I had my script deactivated, though I only noticed it was deactivated when I rewrote my script to ensure it would work and added print scripts and since nothing printed I knew it was off I have a working script that I made and even if it is sloppy im keeping it for the sake of having it my own. |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 07 Jul 2014 01:58 AM |
| Stop using if statements u nobs |
|
|
| Report Abuse |
|
|
tarrdo
|
  |
| Joined: 24 Jun 2008 |
| Total Posts: 476 |
|
|
| 07 Jul 2014 11:09 AM |
Stop using if statements u nobs
Friends: 4 Forum Posts: 18,357 Place Visits: 0 Knockouts: 6,494 Highest Ever Voting Accuracy: 79%
I don't think you bothered to read what I had said but I did remove the if statements and it doesn't work, so how about you and your 0 place visits with your pro scripting skills shove it? |
|
|
| Report Abuse |
|
|