API to check if user is owner from game (or group owner)?

Hi there!

I’d like to make a request thingy in my roblox game, which has to be able to check from any game if the player I specify is owner from a game.

For example, I join my hub, and enter the game id or place id from Jailbreak. I press “check”, and it will say “You’re not the owner”. If the actual owner would join, it’d say “you are the owner”.

I’m not asking for a whole script, I’m just asking how I’d get that specific part to check if a user is the owner from a game / place.

Thanks in advance!

Kind regards,
Jonas

4 Likes

Get the Id from you group, and the owner role. (255 I think) Will it be onjoin and show a UI or when the person touches a part?

I think what he’s trying to accomplish is if a player is an owner of any game ID he puts in. So if he puts in his game ID, he would be recognized as the owner. If he put in Jailbreak’s, he won’t be recognized, but asimo3089/badccvoid would.

Check out the Games Api, it will allow you to see all the places a user or group owns. I assume this is what you want instead of DataModel.CreatorId.

1 Like

The only caveat with this is you enter a user’s ID and get their games, not the other way around (you mentioned this). The only way this could work is if, when you enter a PlaceID, it cycles through every player and group until it finds someone owning it (which would not be feasible).

Is this what you mean?
https://games.roblox.com/docs#!/Games/get_v1_games_multiget_place_details

Returns details on the place and will send back the creator of the place (builder) username and user Id

This is probably the best way to do it as taken directly (with a few modifications) from a few lines of script from ModelMakerLua’s admin commands:

local PlaceId = 0 --Just put the ID here
local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(PlaceId)

if PlaceInfo.Creator.CreatorType == "Group" then --Owner if the place is in a group
	GameOwner = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Name
elseif PlaceInfo.Creator.CreatorType == "User" then --Owner if it was published to their profile
	GameOwner = PlaceInfo.Creator.Name
end
print(GameOwner)
-- If you check the ID of the owner instead of their name, also use this.
if IdOfOwner == game.Players:GetUserIdFromNameAsync(GameOwner) then
	print("It's ze owner!")
end
8 Likes

Using it in a manner like that is definetly not feasible, what you would instead do is get all the possible games a user and their groups own and cache the results from there. MarketplaceService:GetProductInfo() is definetly what he was looking for, however caching results would only require a few requests at most.

I know, I stated that. Thank you though.