Not too sure, I scraped the API and I can’t figure out what I’m doing wrong.
I’m creating a service on the server, creating a controller on the client, I’m initializing Knit on both, adding the services & controllers using .AddServices and .AddControllers. I’m warning on the client and the server to give me a clear indication of when the services have initialized and started through usage of :KnitInit and :KnitStart, yet no matter what I do I’m given the following error:
ReplicatedStorage.Knit.KnitClient:126: Could not find service “MainService”
I’ll leave the code here in the important snippets as the rest of the code is unrelated to Knit and wouldn’t affect the issue.
–Client
Knit = require(ReplicatedStorage.Knit)
RemoteSignal = require(Knit.Util.Remote.RemoteSignal)
MainController = Knit.CreateController { Name = "MainController" }
function MainController:KnitInit()
warn("Main Controller Initialized")
end
function MainController:KnitStart()
warn("Main Controller Starting")
local MainService = Knit.GetService("MainService")
MainService.OnBlockUpdate:Fire()
end -- end of KnitStart
return MainController
SERVER:
ReplicatedStorage = game:GetService("ReplicatedStorage")
Knit = require(ReplicatedStorage.Knit)
RemoteSignal = require(Knit.Util.Remote.RemoteSignal)
local MainService = Knit.CreateService { Name = "MainService", Client = {} }
function MainService:KnitInit()
warn("Main Service initialized")
self.Client.OnBlockUpdate = RemoteSignal.new()
self.Client.OnBlockUpdate:Connect(function(Player)
print("Invoked")
end)
end
function MainService:KnitStart()
warn("Main Service started")
end
return MainService