game.CreatorId in client-side test environments is 0

I’ve got a simple block of code in a LocalScript that destroys it if the player is not the game’s owner:

if player.UserId ~= game.CreatorId then
    print(player.UserId, game.CreatorId)
    wait()
    script:Destroy()
end

However, it has one issue: in a test environment (Accurate Play Solo, Local Server), game.CreatorId is always 0 on the client. This means that the script will always be removed.

This behavior is unintuitive and probably unintentional. It creates bugs in code, and breaks scripts like the one I showed.

A temporary fix to this is to simply add a second condition, game.CreatorId ~= 0, but I should not have to do this, and trying to debug this is a waste of a time (especially when you don’t know the cause).

5 Likes

This is not a bug, it’s been like this forever (AFAIK). Changing this would break a lot of games that use this as a means to differentiate between testing and live sessions.

edit: welp

This does seem like a bug - testing in Studio should be the same as testing online as much as possible.

I’ll file a ticket internally for us to fix this.

8 Likes

I’m okay with them fixing this and breaking those games. It’d be one thing if they were using Game. Job ID, but Creator ID is a super hacky work around. We have run service methods to check which environment a script is running in, so this would likely be old games anyway.

if anyone’s game is using Creator ID or job ID, they should switch to run service.

6 Likes

Apparently this was supposed to be solved years ago, but the issue has not been fixed. Any news on when this will happen?

Screen Shot 2020-04-17 at 12.00.28 AM

6 Likes

Bumping this again, its not a massive problem but I would like for this to work.

Also about this I’m creating a playerlist so I’m trying to detect whether a player is the owner not the specific client.

2 Likes