Hey all. Is there anyway to improve map loading? when ever a map loads from my game i often have like 2 or 3 seconds of lag. Is there anyway to improve this system?
– Script --------------------------------------------------------------------
GameTime = 5 – In Minutes
Music = game.Workspace:WaitForChild(“Music”)
debris = game:GetService(“Debris”)
Players = game:GetService(“Players”)
SS = game:GetService(“ServerStorage”)
Maps = SS:WaitForChild(“Maps”)
CurrentMap = script.Parent.Parent:WaitForChild(“CurrentMap”) – Current map in your world
Image = script.Parent.Parent:WaitForChild(“Image”)
MapCreator = script.Parent.Parent:WaitForChild(“MapCreator”)
Timer = script.Parent:WaitForChild(“GameTime”)
TimerMinutes = Timer:WaitForChild(“Minutes”)
TimerSeconds = Timer:WaitForChild(“Seconds”)
EnableTimer = script.Parent.Parent:WaitForChild(“TimerEnabled”)
TimerMinutes.Value = GameTime
EnableTimer.Value = true
----- FUNCTIONS -----------
function LoadMap(Map, Creators, MapImageId)
CurrentMap.Value:Destroy()
CurrentMap.Value = nil
```
Image.Value = MapImageId
MapCreator.Value = Creators
local NewMap = Map:Clone()
NewMap:MakeJoints()
NewMap.Parent = game.Workspace
CurrentMap.Value = NewMap
print("Loaded " .. Map.Name)
TimerMinutes.Value = GameTime
TimerSeconds.Value = 0
EnableTimer.Value = true
for i, player in pairs(Players:GetPlayers()) do
local H = player.Character:FindFirstChild("Humanoid")
if H then
H.Health = 0
end
end
```
end
----- END OF FUNCTIONS ------
while true do
wait(GameTime * 60)
LoadMap(Maps[“Gladiator Zone”],“Ethanthegrand14”,3938377605)
wait(GameTime * 60)
LoadMap(Maps[“Volcanic Lands”],“Ethanthegrand14”,3942548162)
end