Some game services are named "Instance", not their actual service name

Some services are by default not named their service name, but instead are kept to the default name of “Instance”, and for all services that this affects, it has been the case since their inception. This means developers have to use game:GetService("ServiceName") instead of game.ServiceName in order to get the service, and that may conflict with their usual programming patterns.

For a quick example, type this into your command bar:

print(game:GetService("UserInputService").Name)

You will see “Instance”, instead of the expected “UserInputService”.

Running this in the command line will show you all the services that have this bug (that the command line has the appropriate security context to use):

local function test(service)
	if service.Name == "Instance" then
		print(service.ClassName)
	end
end

for _,service in pairs(game:GetChildren()) do
	pcall(test, service)
end
KeyframeSequenceProvider
TimerService
UserInputService
KeyboardService
MouseService
ScriptService
LuaWebService
RuntimeScriptService
ControllerService

While most of these are internal, it’s still unexpected behavior.

10 Likes

GetService is the canonical way to get a service.

Rather than relying on Name, which can change around and isn’t generally portable between different DataModels, it uses the service’s class name, which can never change.

8 Likes

That may be true, but it’s still unexpected behavior and certainly not intentional.

3 Likes

It seems better to keep the names as-is so that people don’t start forming assumptions about them.

4 Likes