Hello! I was wondering how to let users input a decal ID and have it inserted into the game.
I’m making a game similar to Group Recruiting Plaza and want to allow users to upload a decal to their booth.
I’ve been doing a lot of looking on the DevForum and Wiki, but I can’t figure this out.
If it’s being handled from a TextBox that you can type in, you could probably handle RemoteEvents to fire the Decal ID sent from the client to the server & encase it in a pcall to check if the Decal ID is a valid ID or not & if it is you can insert it to their booth
That would require using InsertService - which requires that the game owner is the creator of the decal. I can’t insert the ID directly into a Decal instance, as it needs to be an ImageID.
When I run that: Logo.Decal.Texture = "rbxassetid://"..logoid
I get this warning in the output and the decal doesn’t change: Image https://assetdelivery.roblox.com/v1/asset?id=1522361034 failed to load. Error 403: Asset type does not match requested type
If you have any experience with web development, there is actually a way to resolve a decal ID to the asset ID.
It’s very convoluted and requires you to make a httpservice request to your own server with the necessary code to process, but it is possible. The API you’d be looking at using if you went down that route is https://assetdelivery.roblox.com/v1/assetId/<id>
I should add, though, that asking player to provide a decal ID is poor UX in itself and should be avoided save for power users.
Ah, I thought you couldn’t use the Roblox API on Roblox. I’ll definitely try this out, thank you!
Everybody who is uploading decals is trusted in the community - about 30ish total. It’s a private game for a group.
You’re correct, you can’t use Roblox APIs with HttpService - as I said you’d have to have your own web server which then in turn requests the Roblox API and does some wacky stuff with the return from that API to determine the correct ID.
function getImageID(scanOrgin)
local result;
local getItemInfo = game:GetService('MarketplaceService');
local creator = getItemInfo:GetProductInfo(scanOrgin).Creator.Id;
local assetT = getItemInfo:GetProductInfo(scanOrgin).AssetTypeId;
if assetT == 13 then
repeat
scanOrgin = scanOrgin -1
until getItemInfo:GetProductInfo(scanOrgin).Creator.Id == creator and getItemInfo:GetProductInfo(scanOrgin).AssetTypeId == 1
result = scanOrgin
else
result = 'Not a decal!'
end
print("module", result)
return result
end
return getImageID
Original code belongs to J_J - made some changes.
How it works:
Whenever you upload a decal to Roblox, it first uploads an image, then a decal. This script loops (using repeat) backward through IDs uploaded to Roblox and looks for any made by the same creator as the decal. Images and decals are uploaded milliseconds apart, so you don’t have to worry about accidentally getting a different decal from the same creator.
Input a decal ID as an int and since the image is uploaded before the decal, looping backward and finding an asset by the same creator will give you the image id.