I am making a game with custom cards, and came across a problem
Only image ids that were already in the studio are allowed
Any other images I try to add through scripts aren’t visible
Are the images you’re adding newly submitted? If so they could still be being processed by Roblox.
just one of them, the other is 2 days old.
Could you post the script you’re using and the Image IDs you tried?
Datastore manager:
local DataStoreService = game:GetService("DataStoreService")
local cardStore = DataStoreService:GetDataStore("PlayercardList")
local CardService = require(script.CardHandler)
game.Players.PlayerAdded:Connect(function(player)
if cardStore:GetAsync(player.Name) then
cardStore:SetAsync(player.Name , {
{["Name"] = "nil", ["Color"] = "http://www.roblox.com/asset/?id=6865281448", ["Display"] = "http://www.roblox.com/asset/?id=6865303015", ["Power"] = 50, ["Health"] = 50, ["WhiteCost"] = 1, ["RedCost"] = 1, ["BlueCost"] = 1, ["GreenCost"] = 0, ["YellowCost"] = 0, ["Trigger"] = nil, ["Effect"] = nil},
{["Name"] = "boyparis", ["Color"] = "http://www.roblox.com/asset/?id=6865280863", ["Display"] = "http://www.roblox.com/asset/?id=6873565000", ["Power"] = 400, ["Health"] = 5000, ["WhiteCost"] = 10, ["RedCost"] = 3, ["BlueCost"] = 3, ["GreenCost"] = 3, ["YellowCost"] = 3, ["Trigger"] = nil, ["Effect"] = nil}
})
end
print(cardStore:GetAsync(player.Name))
local pos = 0
for i , v in pairs(cardStore:GetAsync(player.Name)) do
local card = CardService.Unserialize(v)
print(card)
card.Parent = player.PlayerGui.HandGui.ScrollingFrame
card.Position = UDim2.new(pos,0,0,0)
print(card.Position, pos)
pos += 0.2
end
end)
ModuleScript with Unserialize function
local module = {}
module.Unserialize = function(Properties)
local card = game.ReplicatedStorage.EmptyCard:Clone()
card.Name = Properties["Name"]
card.Border.Image = Properties["Color"]
card.Display.Image = Properties["Display"]
card.Power.Text = Properties["Power"]
card.Health.Text = Properties["Health"]
local distance = 0.13
local colors = {"White","Yellow","Green","Blue","Red",}
for i , color in pairs(colors) do
card.Costs[color].CostLabel.Text = Properties[color .. "Cost"]
if tonumber(card.Costs[color].CostLabel.Text) <= 0 then
card.Costs[color].Visible = false
else
card.Costs[color].Position = UDim2.new(distance,0,0.91, 0)
distance += 0.075
end
end
return card
end
return module
Ids:
second card image:
6873565000
First card border:
6865281448
Have you checked the IDs are being set? As in when you click on the objects have the IDs been set to the correct image ID?
Try putting those IDs on decals or ImageLabels and then use the id generate in the Image property from the Gui, in your scripts.
Roblox doesn’t convert rbxassetid://id
or id
automatically (from scripts), therefore, it needs to be done manually using InsertService:LoadAsset(). Here’s a sample:
--Script in ServerScriptService
local assetId = 6816975612 --replace with your image id
local ins = game:GetService("InsertService") --obtaining service (Script only)
local img = ins:LoadAsset(assetId):GetChildren()[1].Texture
--as it returns a model, we extract the children, and get the property we need. As we're doing an image, .Texture is used (hence it's a decal)
print(img) --prints out as "http://www.roblox.com/asset/?id=6816975570"
--img can now be used as an id for ImageLabels
Try copying and pasting just the ID of the image into the ImageLabel then copy and paste the URL it provides into the script.
Yup that’s what i ended up doing.