Finding the Game Owner

Would the following script work to find the game owners ID?

local PlaceId = game.PlaceId
local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(PlaceId)
local gameOwner = nil
if game.CreatorType == Enum.CreatorType.Group then
    gameOwner = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Id
else
    gameOwner = game.CreatorId
end
1 Like

Did you try testing it before posting?

1 Like

I did and it returned this:
998796

That’s because it’s getting the owners UserId, hence “game.CreatorId”

Yeah but
https://roblox.com/users/998796/profile
is not me.

game.CreatorId points to the ID of the player or the group that owns the place, so there is no need to make the call to MarketplaceService (which is probably where the issue is).

local gameOwner
if game.CreatorType == Enum.CreatorType.Group then
    gameOwner = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId).Owner.Id
else
    gameOwner = game.CreatorId
end

This will return the ID of the owner of the place (if it’s owned by a player) or the ID of the owner of the group that owns the place (if it’s owned by a group). Based on your original script, I assume this is what you want.

3 Likes

I still get the 998796 as the printed game owner.

when i looked up his User ID I got Templates - Roblox, is this correct?

Yeah I also did that. Its weird why I get that.

Can you paste the link to the game that you’re running the script in?

What is this for, why can’t you just get the username but literally typing it out?

Because Im seeing if the game owner matches my User Id, and if not, it deletes the thing from the game.

So you’re going to make this a free model, like a admin model, or something like that?

Nope, Im selling it, but Im preventing leaking here.

what he said

30

How would that help? What would that do?

So we can see the place and the owner’s ID

I found the issue! The game was not published! Sorry for bother you guys.

This might be a little OT but figured this advice might be helpful. It’s rather pointless using a system such as this to prevent leaking as the script, or that portion of the script can very easily be removed.

I obfuscate the script to prevent that.