game:GetService(name) cannot create a function

hi, I was working at my dog simulator, but I was wanting to create a Service named ‘DogService’, I see at https://developer.roblox.com/en-us/api-reference/class/DataModel u can use game:GetService(‘DogService’) but it always errors:

20:17:04.413 - ‘DogService’ is not a valid Service name

Are you sure it’s a valid Service name? Perhaps the Wiki hasn’t been updated in a while.

Did you mean functions? Because Services are made by roblox.

i don’t use Wiki, i use developer.roblox.com

game:GetService() is used to get existing Roblox game services. You cannot create them.

The DataModel is just your game’s hierarchy.

I mean Services, at https://developer.roblox.com/en-us/api-reference/class/DataModel it says u can create a custom Service if that Service doesn’t exists

to create a function you just have to declare it : function dog() --This is a function that i created right now end

If you are referring to this:

This means if the service hasn’t already been requested, it will be requested. It does not mean you can create your own.

5 Likes

When it says “create” it doesn’t mean create your own custom service, it means enable that sevice if you wanna interpret it that way. Some built-in services made by roblox exist but aren’t loaded in, it exists, but it’s not there by default, you have to create it.