Services

Services are module scripts that serve a specific purpose. For example a experience may have a service for GameUI, Points, etc.

Creating a service

You can create a service by creating a new ModuleScript under one of Knights Services folders. Learn how to find knight service folders Folders explanation.

Template

Each service is structured with this template.

local Knight = {
	ServiceName = script.Name,
	ServiceData = {
		Author = "vq9o",
		Description = "Example Service example"
	},
	CanStart = true,
	CanUpdate = true,
}

function Knight.Init()
	warn("Example Service inited!")
end

function Knight.Start()
	warn("Example Service Started!")
end

function Knight.Update(DeltaFrame)
	warn("Example Service called for new frame!")
end

return Knight

Default Functions

Init

Config

CanStart, CanUpdate, CanInit variable allow execution of the .Update(), .Start(), and .Init(). Useful if your using a third-party module and you need to disable Knight from calling its default start function like CameraShaker.

Config is not required and will default to true.

Priority Startup

Folders named as "Database" will have first priority to init, then folders named "Priority" will init. Useful to load core game backend first.

Last updated

Was this helpful?