This is an odd question, but is there a way to get the Studio user’s “Player”? I don’t mean in test mode. The Studio “Player” only seems to appear in Team Create, but not in solo.
Let’s say I were writing a plugin and wanted to check if the player owned a certain item, or were apart of a certain group, or anything like that which would require a “Player”. Is there a way to get said “Player”? Or maybe get the UserId of the Studio user? CreatorId only works in a published game, and only if it’s a non-group game.
It’s alright. However, it seems even with game.CreatorId, it doesn’t work in a non-Team Create game as shown here:
local M = game:GetService('MarketplaceService')
local P = game:GetService('Players')
local p = P:GetPlayerByUserId(game.CreatorId)
local owned = M:PlayerOwnsAsset(6312892237,p)
print(owned)
- 08:58:11.051 Argument 2 missing or nil - Edit
08:58:11.051 Stack Begin - Studio
08:58:11.051 Script 'local M = game:GetService('MarketplaceService')
local P = game:GetService('Players')
local p = P:GetPlayerByUserId(game.CreatorId)
local owned = M:PlayerOwnsAsset(6312892237,p)
+ print(owned)', Line 4 - Studio
08:58:11.051 Stack End - Studio
I also just realized that CreatorId will get the actual CreatorId and not the Studio user’s Id.
Sadly, I apparently can’t get a “Player” out of a UserId without the player existing in the Player list. Is there another way to see if a player owns an item via Studio?
I suppose I could theoretically use a one-time verification setting using plugin settings that save, but that would require the user to open a team create just for verification, which isn’t ideal.
I wish there was just a plugin:GetPlayer() or plugin:PlayerOwnsAsset() type of thing.
I don’t know what you’re doing, but if it’s supposed to be exclusive for players who own the item, it can be manipulated changing the plugin settings json file.
local plr = Instance.new(“player”)
plr.UserId = game:GetService(“StudioService”):GetUserId()
local MPS = game.MarketplaceService
local result = MPS:PlayerOwnsAsset(plr, 123456689)
Unfortunately, you can’t create a Player instance.
I ended up dropping this as anyone could simply edit the plugin to bypass this check, and now obfuscated public assets (including plugins) are against the rules, so sadly this wasn’t worth pursuing in the end.