#Round system

1 messages · Page 1 of 1 (latest)

arctic haven
#

I have a round system going but it doesnt load/unload the maps. So im trying to figure out how i would do that since .IsLoaded is read only. this isnt really a problem with my script, just looking for some guidance

arctic haven
#

ok i've figured out how to unload/load but im having trouble referencing unloaded maps

#

since unloading is setting the parent to nil, im not sure how i should reference the map after it gets parented

#

and having a variable for each map is just alot of work considering the capacity im planning to have it be in the future

leaden iron
#

Something like this

local Module = {}
local CurrentMap: Folder?

function Module.LoadMap()
  if CurrentMap ~= nil then
    warn(`attempted to load a map over another one \n {debug.traceback()}`)
    return
  end
  local chosenMap = GetChosenMap()
  chosenMap.Parent = workspace
  CurrentMap = chosenMap
end

function Module.UnloadMap()
  if CurrentMap == nil then
    return
  end
  CurrentMap.Parent = ServerStorage
  CurrentMap = nil
end

return Module
worldly flume
#

Also itd be better to use attributes than variables imo

arctic haven
#

ok i forgot i made this post so i forgot to mark it solved, but yeah i solved it

#

instead of nil i changed the parent to a folder parented to my script

arctic haven
#

i've heard people also use replicated storage to store their maps so if anyone is wondering how you'd do this then consider using replicated storage

worldly flume
#

This removes the need to continuously load/unload maps which can take a while depending on map size

#

For small maps p much any method will work

arctic haven
#

i did that before but it gets annoying having to move to them

worldly flume
#

Wdym

#

You move them once and ur done

arctic haven
#

i know i can just set my camera with currentcamera in console and stuff

worldly flume
#

You can just send them into oblivion

arctic haven
#

i move from 1 map to another

worldly flume
#

And itll tp you

arctic haven
#

oh

#

thats actually pretty cool

worldly flume
#

😭

arctic haven
#

eh i already have this system going

#

im sure theres some other reasons why this is better too

worldly flume
#

Yeah might aswell keep it as long as your maps arent too big

arctic haven
#

so i'll just keep it

#

mhm

worldly flume
#

But i doubt ur game is performance heavy enough for it to matter anyway

arctic haven
#

alr

worldly flume
#

So it should be case

arctic haven
#

i doubt its anything i have to worry about

worldly flume
arctic haven
#

like 0.3s delay is all

#

should be good then