Recently, I have spent time scripting a system that loops through each image ID, switching the image label’s image to it and emulating the behaviour of a video. However, I keep getting the following error:
15:39:33.616 Image https://assetdelivery.roblox.com/v1/asset?id=7103055634 failed to load. Error 403: Asset type does not match requested type - Studio
Code:
local idTable = {} --A lot of IDs go in here in the actual script
local imageLabel = script.Parent
local ContentProviderService = game:GetService("ContentProvider")
local sound = script.Parent:WaitForChild("Sound")
local preloadedCount = 0
local function UpdateDone()
preloadedCount += 1
script.Parent.Parent.Background.TextLabel.Text = "Loading... Preloaded "..preloadedCount.." so far..."
end
for _, ID in pairs(idTable) do
ContentProviderService:PreloadAsync({"rbxassetid://"..ID}, UpdateDone)
end
local counter = 1
local lastLoadedId
script.Parent.Parent.Background.Visible = false
sound.Playing = true
while sound.Playing == true do
script.Parent.Image = "rbxassetid://"..idTable[counter]
wait()
end
It’s because the script needs the asset image id, instead of the decal id, I see you’re using rbxassetid:// already, but images asset id (or contentid) are not always formatted as rbxassetid://, a better method would be using rbxthumb://:
But now when I set the image to that it stays a black screen. Current code:
local preloadedCount = 0
local function UpdateDone()
preloadedCount += 1
script.Parent.Parent.Background.TextLabel.Text = "Loading... Preloaded "..preloadedCount.." so far..."
end
for _, ID in pairs(idTable) do
ContentProviderService:PreloadAsync({string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", tostring(ID))}, UpdateDone)
end
local counter = 1
local lastLoadedId
script.Parent.Parent.Background.Visible = false
sound.Playing = true
while sound.Playing == true do
script.Parent.Image = string.format("rbxthumb://type=Asset&id=%s&w=420&h=420", tostring(idTable[counter]))
wait()
end
The link appears to be trying to access a decal. The file returned by that link is an XML file. The URL for your image appears to be http://www.roblox.com/asset/?id=7103055625.
It should be noted that clicking the above link will not bring you to the asset, but it should load your image in-game if that link is supplied to the decal.
Are you using your original code or the codes provided? When I use your original code, if I plug the ID into your table and put it into a LocalScript parented to an ImageLabel, it changes the graphic to the correct image.
local idTable = {7103055625} --A lot of IDs go in here in the actual script
local imageLabel = script.Parent
local ContentProviderService = game:GetService("ContentProvider")
local sound = script.Parent:WaitForChild("Sound")
local preloadedCount = 0
local function UpdateDone()
preloadedCount += 1
script.Parent.Parent.Background.TextLabel.Text = "Loading... Preloaded "..preloadedCount.." so far..."
end
for _, ID in pairs(idTable) do
ContentProviderService:PreloadAsync({"rbxassetid://"..ID}, UpdateDone)
end
local counter = 1
local lastLoadedId
script.Parent.Parent.Background.Visible = false
sound.Playing = true
while sound.Playing == true do
script.Parent.Image = "rbxassetid://"..idTable[counter]
wait()
end