Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Delayed Command/Type Registration #343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Cmdr/CmdrClient/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,18 @@ end
-- "Only register when we aren't in studio because don't want to overwrite what the server portion did"
-- This is legacy code which predates Accurate Play Solo (which is now the only way to test in studio), this code will never run.
if RunService:IsServer() == false then
Cmdr.Registry:RegisterTypesIn(script:WaitForChild("Types"))
Cmdr.Registry:RegisterCommandsIn(script:WaitForChild("Commands"))
local TypesFolder = script:WaitForChild("Types") :: Folder
local CommandsFolder = script:WaitForChild("Commands") :: Folder

Cmdr.Registry:RegisterTypesIn(TypesFolder)
Cmdr.Registry:RegisterCommandsIn(CommandsFolder)

TypesFolder.ChildAdded:Connect(function(child: Instance)
require(child)(Cmdr.Registry)
end)
CommandsFolder.ChildAdded:Connect(function(child: Instance)
Cmdr.Registry:RegisterCommand(child)
end)
end

-- Hook up event listener
Expand Down