Hey,
I need help learning on how to handle RunService connections correctly or any connections that delay the script.
Here’s my module
local Framework = {}
Framework.__index = Framework
--[ Services ]--
local RunService = game:GetService("RunService")
function Framework.new()
local self = setmetatable({},Framework)
return self
end
function Framework:Initilize()
local Modules = script:GetChildren()
for _,Component in pairs(Modules) do
print("Initilized: "..Component.Name)
if Component.Name == "Viewmodel" then
local Module = require(Component)
local Viewmodel = Module.new()
Viewmodel:Equip()
local function Update(DeltaTime)
Viewmodel:Update(DeltaTime)
end
RunService.RenderStepped:Connect(Update) -- this is the problem
end
if Component.Name == "Movement" then
local Module = require(Component)
Module.new()
end
end
end
return Framework
When I play the game, the runservice delays the script and other components are not able to be initilized.