How Can I Get A Game Creator's Username?

Hello! I was wondering how I can get the game creator’s username. Currently, I only found out
game.CreatorId but I was wondering if there is something like game.CreatorName. Help is greatly appreciated!

2 Likes

You could do that by using game.CreatorId. (let me show you how!)

local creatorName = game.Players:GetPlayerByUserId(game.CreatorId)

But, the creator would have to be playing the game. My code won’t work in some cases, but it was the only thing I could think of.

I don’t know if game.Parent will give you the player’s name?

1 Like

I have tried that around 2 weeks ago. I will just wait and see if someone replies with a different answer. Thanks for your contribution though!

1 Like

@IAmPinleon I have tried game.Parent and I can confirm it does not work.

Screen Shot 2020-05-06 at 8.46.21 am

That was actually a great idea though! :smiley:

This code should give you the creator’s name.

local players = game:GetService("Players")

local function GetCreatorName()
    if game.CreatorType == Enum.CreatorType.User then --Check if they are a user
        return players:GetNameFromUserIdAsync(game.CreatorId)
    end
end
2 Likes

You can use Players::GetNameFromUserIdAsync to get a name from a given user ID.

However, game.CreatorId if the game is a group game, will give you the group ID instead.

So you can do GroupService:GetGroupInfoAsync(game.CreatorId).Owner to get the name of the owner of the group

7 Likes

Would I be able to improve that code using an elseif for a group using @sjr04’s other code?

You can actually just use an else rather than an elseif, but yes would be able to improve it.

1 Like

Hi, @IAmPinleon,
I’ve tried with that and it only returns a Instance, that is the given player with the userId.
If that player with that ID is not playing, it will return nil.

You can try with this (this works btw):

    `local creatorName  = game.Players:GetNameFromUserIdAsync(game.CreatorId)`

And yes, it prints the creator name.
For suggestions or questions of this post, message me.

2 Likes