Good day, I am trying to have images show up when a user hits a button.
My issue is that my custom made decals wont show up, but toolbox ones will.
All my decals are un-moderated and load in perfectly fine, but just wont load from a script. Keep in mind the toolbox ones from others will, just not my own.
Here’s a video on what’s happening
I don’t know what’s going on. I’ve tried loading it from an array, and loading it using a rbxassetid string. Both to no avail.
Any help is wonderful, thank you guys in advance.
1 Like
Wanting to note that the ninja run animation is the only image that loads, the other three (ones by me) wont load.
Remember that inputting it manually works fine, as shown here (also my decal)
I encountered the same issue a while back. This could be due to you using the decal ID instead of the image ID. To fix, place the id of the desired decal into an image label. Hope I helped!
i was also using the “http://www.roblox.com/asset/?id=” at one point. but still didnt work
this was my code then
--ITEM DATA
local RocketData = {
"Rocket Launcher", -- Item
"100 Robux", -- Price
"Want to cause mass amounts of explosions? Maybe blow you or your friends into little pieces? This is the gamepass for you! Purchasing will grant you the ability to use the Rocket Launcher Weapon.",
"http://www.roblox.com/asset/?id="..9821278749, -- Decal ID
49671233 -- GamePass
}
local BombData = {
"Bomb", -- Item
"50 Robux", -- Price
"Do you like the good ol days of blowing stuff up? The bomb is the perfect choice for you!. Purchasing will grant you the Bomb Weapon.",
"http://www.roblox.com/asset/?id="..9821278192, -- Decal ID
49671283 -- Gamepass
}
local TrowelData = {
"Trowel", -- Item
"50 Robux", -- Price
"Tired of your friends blowing you up? Use the trowels to build walls out of thin air! Purchasing will grant you the Trowel tool.",
"http://www.roblox.com/asset/?id="..9821277080, -- Decal ID
49671486 -- gamepass
}
local RunData = {
"Faster Run", -- Item
"80 Robux", -- Price
"Friends killing you too much? Buying this pass will make you become way faster than anyone, and outrun your pesky friends. Purchasing will grant your running speed to increase from 40 --> 58",
"http://www.roblox.com/asset/?id="..917776098, -- Decal ID
}
-- Varibles
local GUI = script.Parent
local RocketBuy = GUI.BuyRocketLauncher
local BombBuy = GUI.BuyBomb
local TrowelBuy = GUI.BuyTrowel
local RunSpeedBuy = GUI.BuyRunSpeed
local Sidebar = GUI.Display
local ItemName = Sidebar.ItemName
local Description = Sidebar.Description
local Image = Sidebar.GamePassImage
local Price = Sidebar.Price
local BuyButton = Sidebar.Buy
local gamepass = 35168500
local MPS = game:GetService('MarketplaceService')
local player = GUI.Parent.Parent.Parent
RocketBuy.MouseButton1Click:Connect(function()
ItemName.Text = RocketData[1]
Price.Text = RocketData[2]
Description.Text = RocketData[3]
Image.Image = RocketData[4]
gamepass = RocketData[5]
end)
BombBuy.MouseButton1Click:Connect(function()
ItemName.Text = BombData[1]
Price.Text = BombData[2]
Description.Text = BombData[3]
Image.Image = BombData[4]
gamepass = BombData[5]
end)
TrowelBuy.MouseButton1Click:Connect(function()
ItemName.Text = TrowelData[1]
Price.Text = TrowelData[2]
Description.Text = TrowelData[3]
Image.Image = TrowelData[4]
gamepass = TrowelData[5]
end)
RunSpeedBuy.MouseButton1Click:Connect(function()
ItemName.Text = RunData[1]
Price.Text = RunData[2]
Description.Text = RunData[3]
Image.Image = RunData[4]
end)
BuyButton.MouseButton1Click:Connect(function()
MPS:PromptGamePassPurchase(player, gamepass)
end)
local function getAssetIDFromURI(uri)
return tonumber(uri:match("%d+"))
end
local function convertToImageID(decalID)
if typeof(decalID) ~= "number" or decalID < 1 or decalID%1 ~= 0 then
return false
end
local objects
local success, err = pcall(function()
objects = game:GetObjects("rbxassetid://"..decalID)
end)
if not success then
return false
end
if not objects or #objects < 1 then
return false
elseif #objects > 1 then
return false
end
local decal = objects[1]
if not decal:IsA "Decal" then
return false
end
local imageID = getAssetIDFromURI(decal.Texture)
if not imageID then
return false
end
return imageID
end
local decalId = 12345 -- place your decalId here
local imageId = convertToImageID(decalId)
print(imageId) -- Look in the output
Have you tried using to string for the ID?
Unable to assign property Image. Content expected, got boolean - Client - sidebarHandler:108
20:45:01.798 Stack Begin - Studio
20:45:01.798 Script ‘Players.omotashi.PlayerGui.Shop.Main.sidebarHandler’, Line 108 - Studio - sidebarHandler:108
Then, what you have is not a decal ID, it’s an imageId.
Image.Image = "rbxassetid://9821278749"
Try something like that.
Yes, but it didnt work. same result
That’s what I have on right now, but it didnt work
You put an “S” at the end of the string. Try removing that…
that was me using “Win+Shift+S” to take a screenshot, it wasnt like it before!
Image.Image = "rbxassetid://9821278740"
I tried converting it myself and I got this id.
Decal: 9821278749
Image: 9821278740
Image Link: https://www.roblox.com/library/9821278740
I’ve tested it, and it seems to work fine:
I fixed it.
I had to copy the asset ID into the “Image” section on the ImageLabel to get the image ID. It works now, thanks for your help