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)`