What is game.Instance

I was coding then saw game has something called instance in it and I cant seem to find docs on it what is it?

so far I found that the class name is KeyframeSequenceProvider

It is kind of weird how that is a publicly accessible property.

My guess is it’s just a reference to the physical instance that is associated with the DataModel type (in which game references)

Since all object classes derive from the instance base class.

1 Like

Are you asking specifically “game.Instance” or just Instance?

It looks like it just picking up the main game as an instance, cause I’ve tried this and it printed the game name

print(game.Instance.Parent.Name)

To add on this, I also tried Destroying “game.Instance” and this returns

image

It is odd for real! Because you can achieve the same thing SEEMINGLY, by doing this…

if object.ClassName then
     object == game.Instance  --MAYBE
end

Maybe game has it as a property because game itself isn’t a ClassName

Basically It’s an Instance that’s acts as a Parent to the Stuff in Studio like workspace and so on. As well this works too

print(game.Instance.Parent:WaitForChild("Workspace"))

it’s just like

game:GetService("Workspace")

But who knows.

1 Like

I might be wrong, It’s actually a Children of the Game but I just grabbed the Parent of “Instance” so it could be really mean nothing, otherwise I don’t think it’d be helpful.

I have Show Hidden Objects In Explorer set to on, and under game, there is more than one item named “Instance” (yes, Instance is not a property of game)

Here’s a screenshot:
image

All of these are abstract/internal services, it turns out. (PublishService, LuaWebService, ScriptService, etc.)

Instances do not default to having their name (the default is “Instance”). Some that do don’t even default to the class name.

print(game:GetService("RunService").Name) -- Run Service

These aren’t even strictly just internal services. Try this one, for instance:

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

Just more reason to always use game:GetService instead of game.ServiceName :slight_smile:

3 Likes