ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:41 PM |
Map = game.ServerStorage.HoloMaps maps = {"Holo", "MapEasyJumps", "MapMeadowsBridges"}
function cc() for _,v in pairs(maps) do if v then v:Destroy() end end end
--OBBIES script.Parent.FrameObbyMaps.FrameObbyJumps.BtnEasyJumps.MouseButton1Down:connect(function() cc() local map = Map.ObbyMaps.MapEasyJumps:Clone() Map.Parent = workspace table.insert(maps,map) end
CZ |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Mar 2017 01:44 PM |
cc = function() for _,map in pairs(maps:GetChildren()) do if v then v:Destroy() end end end |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:45 PM |
maps is a table with strings
you cant destroy strings |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:46 PM |
@Gom
GetChildren() is now a Nil value
CZ |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:47 PM |
@Iced
How would I do it differently?
CZ |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:48 PM |
| what are you trying to do? |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:48 PM |
heres a better way to insert something into a table.
local namehere = {"...", "ugh"} local something
if something ~= then namehere[#namehere+1] = something end
spawn(function() while wait(10) do print(#namehere) end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Mar 2017 01:51 PM |
| I wrote this code for you. maps is supposed to be initially empty. It it meant to hold the actual map models that are in the workspace. That's why cc() calls Destroy() on the items in the array. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:52 PM |
In fact, I don't even know why i used an array in the first place, if only one map will be used at a time.
Map = game.ServerStorage.HoloMaps CurrentMap = nil
function cc() if CurrentMap then CurrentMap:Destroy() end end
--OBBIES script.Parent.FrameObbyMaps.FrameObbyJumps.BtnEasyJumps.MouseButton1Down:connect(function() cc() local map = Map.ObbyMaps.MapEasyJumps:Clone() Map.Parent = workspace CurrentMap = map end |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:54 PM |
@Mister
Sorry for not giving credit at first, When I click a button, it spawns every map in "HoloMaps"
It takes the Model "HoloMaps" from ServerStorage and pastes in Workspace.
CZ |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:56 PM |
| you cannot use MouseButton1Down in normal scripts |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 01:57 PM |
| To fix that you just need to reference the correct model inside of HoloMaps when you make the copy. |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:58 PM |
@Mister
The new script worked ish, when I click a different map, it doesn't delete the previous map.
CZ |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 01:59 PM |
@Iced
Would I be able to use MouseButton1Click?
CZ |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:01 PM |
no
you need to put it in a localscript inside starterplayerscripts |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:05 PM |
| Now that it's in a local script you'll need to call a remote event to access the maps from server storage. |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 02:05 PM |
If I put it in local scripts, wouldn't it just spawn the map only for me and not anyone else in the game?
CZ |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 02:06 PM |
@mister
I'm sorry I don't know what that is lol, I only know the basic stuff.
CZ |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2017 02:06 PM |
| Use a remote event so that the map spawns on the server side. |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 02:07 PM |
How do I use a Remote event? I don't know what that is.
CZ |
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
|
| 10 Mar 2017 02:35 PM |
| To my knowledge. A RemoteEvent can call a RemoteFunction. So though the script is in a local script, if you do the right coding it'll make the Map spawn for everyone else aswell. |
|
|
| Report Abuse |
|
|
ChadZer
|
  |
| Joined: 14 Dec 2010 |
| Total Posts: 653 |
|
|
| 10 Mar 2017 02:38 PM |
Oh, I don't know how to do that.
CZ |
|
|
| Report Abuse |
|
|
Oryxide
|
  |
| Joined: 09 Jul 2015 |
| Total Posts: 647 |
|
| |
|