I wanna print the creator ID while in studio or is it only possible while being on a roblox server?
print(game.CreatorId) -- This prints the game creator's id. This will not work unless the game is published (I think)
I have the game published but it just gives me CreatorId is not valid member of place1
Is it actually published to roblox or saved to file?
If it’s a local script, I think it won’t work
It’s published to roblox and is a server script
Is it a group game? ----------
If the game’s on a user profile, you could use game.CreatorId
to get the game owner’s id.
However, if the game’s under a group, you’ll need to use GroupService (roblox.com) with it’s GroupService:GetGroupInfoAsync (roblox.com) method to get the group owner’s id.
You can check the creator type via game.CreatorType
.
local CreatorId = game.CreatorId
if game.CreatorType == Enum.CreatorType.Group then
local GroupInfo = GroupService:GetGroupInfoAsync(game.CreatorId)
if GroupInfo.Owner then -- Check if the group has an owner - if it doesn't, this'll be nil
CreatorId = GroupInfo.Owner.Id
end
end
I hope this helped.
I just checked back and roblox seemed to log me out so that might of been the issue