#Round system
1 messages · Page 1 of 1 (latest)
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
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
Setting something to nil deletes it cant you just toggle the enabled property of its parent
Also itd be better to use attributes than variables imo
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
and setting the parent to nil deletes it, but its kept in memory, so if you have reference to it, you can actually still set the parent back to workspace
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
A lot of games just keep all the maps in and just make them reallyy far apart
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
i did that before but it gets annoying having to move to them
i know i can just set my camera with currentcamera in console and stuff
You can just send them into oblivion
i mean when i need to edit them
i move from 1 map to another
Press f with it selected in workspace
And itll tp you
😭
eh i already have this system going
im sure theres some other reasons why this is better too
Yeah might aswell keep it as long as your maps arent too big
I dont think it is in some cases
But i doubt ur game is performance heavy enough for it to matter anyway
alr
So it should be case
btw how big are we talkin
i doubt its anything i have to worry about
If u ctrl c ctrl v ur map in studio does it lag a bit
not rlly
like 0.3s delay is all
should be good then