diff --git a/src/ServerScriptService/Aero/AeroServer.script.lua b/src/ServerScriptService/Aero/AeroServer.script.lua index cb44b3e..9cbac77 100644 --- a/src/ServerScriptService/Aero/AeroServer.script.lua +++ b/src/ServerScriptService/Aero/AeroServer.script.lua @@ -12,13 +12,16 @@ local AeroServer = { local mt = {__index = AeroServer} -local servicesFolder = game:GetService("ServerStorage"):WaitForChild("Aero"):WaitForChild("Services") -local modulesFolder = game:GetService("ServerStorage"):WaitForChild("Aero"):WaitForChild("Modules") -local sharedFolder = game:GetService("ReplicatedStorage"):WaitForChild("Aero"):WaitForChild("Shared") +local servicesFolder = game:GetService("ServerStorage").Aero.Services +local modulesFolder = game:GetService("ServerStorage").Aero.Modules +local sharedFolder = game:GetService("ReplicatedStorage").Aero.Shared +local internalFolder = game:GetService("ReplicatedStorage").Aero.Internal local remoteServices = Instance.new("Folder") remoteServices.Name = "AeroRemoteServices" +local FastSpawn = require(internalFolder.FastSpawn) + function AeroServer:RegisterEvent(eventName) local event = self.Shared.Event.new() @@ -90,7 +93,7 @@ function AeroServer:WrapModule(tbl) tbl:Init() end if (type(tbl.Start) == "function" and not tbl.__aeroPreventStart) then - coroutine.wrap(tbl.Start)(tbl) + FastSpawn(tbl.Start, tbl) end end @@ -155,7 +158,7 @@ function StartService(service) -- Start services on separate threads: if (type(service.Start) == "function") then - coroutine.wrap(service.Start)(service) + FastSpawn(service.Start, service) end end diff --git a/src/StarterPlayer/StarterPlayerScripts/Aero/AeroClient.localscript.lua b/src/StarterPlayer/StarterPlayerScripts/Aero/AeroClient.localscript.lua index 1c1c3b1..81ac5d2 100644 --- a/src/StarterPlayer/StarterPlayerScripts/Aero/AeroClient.localscript.lua +++ b/src/StarterPlayer/StarterPlayerScripts/Aero/AeroClient.localscript.lua @@ -17,6 +17,9 @@ local mt = {__index = Aero} local controllersFolder = script.Parent:WaitForChild("Controllers") local modulesFolder = script.Parent:WaitForChild("Modules") local sharedFolder = game:GetService("ReplicatedStorage"):WaitForChild("Aero"):WaitForChild("Shared") +local internalFolder = game:GetService("ReplicatedStorage").Aero:WaitForChild("Internal") + +local FastSpawn = require(internalFolder:WaitForChild("FastSpawn")) function Aero:RegisterEvent(eventName) @@ -49,7 +52,7 @@ function Aero:WrapModule(tbl) tbl:Init() end if (type(tbl.Start) == "function" and not tbl.__aeroPreventStart) then - coroutine.wrap(tbl.Start)(tbl) + FastSpawn(tbl.Start, tbl) end end @@ -118,12 +121,10 @@ end function StartController(controller) - -- Start controllers on separate threads: if (type(controller.Start) == "function") then - coroutine.wrap(controller.Start)(controller) + FastSpawn(controller.Start, controller) end - end