I am currently trying to make a script that finds the creator of a game. That can be done by doing game.CreatorId, but if the script is running under a group, it will give the group ID.
What I am currently trying to accomplish is finding who the creator of the game is. I have the following script:
local plridN = game.CreatorId
local plrid = tostring(plridN) --The creator's ID
local groupid = plrid --If the game is running under a group, the creator's ID will be a group number
local group = game:GetService("GroupService"):GetGroupInfoAsync(groupid)
local owner = group.Owner
if owner ~= nil then
print(owner.Id) --Prints the group owner's ID number
elseif owner == nil then
print(plridN) --Prints the game owner's (because that number is not a group) ID number
end
In the script, what it is doing is finding the game's creator's ID and then checking if it is a valid group. However, what is happening is if it isn't a group id, it errors on this line:
local group = game:GetService("GroupService"):GetGroupInfoAsync(groupid)
How can I prevent that line from erroring if it isn't a group?
Thanks in advance!

2 comments
Can you paste the exact error code?
20:51:32.165 - GroupService:GetGroupInfoAsync() failed because HTTP 0 (HTTP 404 (HTTP/1.1 404 NotFound))