Changing the image of an image button using a script doesn't work

I’m currently having some trouble with my code that when a button is clicked it inserts an image button into a scrolling frame. When I change the image it doesn’t change for some reason, but when I type the image manually it changes.

Here’s my code for more context:
`local PurchaseGUI = script.Parent
local CaseButton = PurchaseGUI.CaseButton
local player = game.Players.LocalPlayer
local leader = player:WaitForChild(“leaderstats”)
local money = leader:WaitForChild(“Money”)
local capacity = 0 --skins limit variable
local skin = game.ReplicatedStorage.ChromaCase.idk --skin variable

CaseButton.MouseButton1Click:Connect(function()
if capacity <= 49 then
if money.Value >= 1 then
money.Value -= 1
money.Value = math.floor(money.Value * 100 + 0.5) / 100

		local cloned = game.ReplicatedStorage.ChromaCase.idk:Clone() 
		cloned.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("Inventory"):WaitForChild("ScrollingFrame")
		
		
		local Rtier = math.random(1,1000) --tier rarity
		print(Rtier)
		
		local Rblue = math.random(1,5) --blue chance
		local Rpurple = math.random(1,4) --purple chance
		local Rpink = math.random(1,3) --pink chance
		local Rred = math.random(1,2) --red chance
		local Rgold = math.random(1,30) --gold chance
		
		if cloned then --skins limit
			capacity += 1
			if Rtier >= 0 then --deciding skin rarity
				if Rblue == 1 then
					skin.Image = "rbxasset://13046786676" --problem occurs here
				end
				if Rblue == 2 then
					skin.Image = "rbxasset://13046792991"
				end
				if Rblue == 3 then
					skin.Image = "rbxasset://13046807489"
				end
				if Rblue == 4 then
					skin.Image = "rbxasset://13046813711"
				end
				if Rblue == 5 then
					skin.Image = "rbxasset://13046818727"
				end
				
				
			end
		end
		
	end
end

end)`

You’re changing the image of the original ImageLabel, not the one that you cloned. Change the skin.Image to cloned.Image.

It seems to have done something but it’s not changing the image. The thing just comes up blank.

I found out that it’s probably because you’re changing the image to "rbxasset://...". Notice that it uses rbxasset protocol, which is not the one you should be using. It should instead be rbxassetid://

It still comes up blank. I also tried using “http://www.roblox.com/asset/?id=…” and the image ID itself, and they all come up blank.

Are you sure the image id gets loaded?

Sometimes the image may not load up rq, so wait for a while.

When I was using the skin.Image I looked at the properties and it changed, but I’m not sure about the cloned.Image.

Do you know how long I should wait? Cause I’ve been waiting for 10 minutes and it’s still blank.