I am making an upgrade system and, included in this, to show the player how many upgrades they have bought, I use an image label.
The image label updates fine each time until the player reaches the max number of upgrades (5) where the image disappears when the player buys the upgrade and also when they rejoin the game again.
This occurs even though, the Image property updates with the correct id. I don’t think the image has been moderated because it appears fine on the website and also when I go to manually change the id.
I have tried using some other images as a test which I know have not been moderated but some also don’t update in. The only ones which do are the previous 4 upgrade images. Anyone know what is going on?
This is my code:
local upgradeSigns = {
"http://www.roblox.com/asset/?id=11204129845",
"http://www.roblox.com/asset/?id=11229157630",
"http://www.roblox.com/asset/?id=11229166564",
"http://www.roblox.com/asset/?id=11229184851",
"http://www.roblox.com/asset/?id=11229189214",
"http://www.roblox.com/asset/?id=11237486552"
}
local accelerationPrices = {
300,
1500,
5000,
15000,
50000
}
local petStoragePrices = {
100,
500,
1000,
2500,
10000
}
local luckPrices = {
500,
2500,
10000,
40000,
70000
}
accelerationDisplay.upgradeAmount.Image = upgradeSigns[acceleration.Value+1]
if acceleration.Value < 5 then
accelerationDisplay.price.Text = AbbreviateNumber:Abbreviate(accelerationPrices[acceleration.Value+1])
else
accelerationDisplay.price.Text = "Max"
end
petStorageDisplay.upgradeAmount.Image = upgradeSigns[petStorage.Value+1]
if petStorage.Value < 5 then
petStorageDisplay.price.Text = AbbreviateNumber:Abbreviate(luckPrices[petStorage.Value+1])
else
petStorageDisplay.price.Text = "Max"
end
luckDisplay.upgradeAmount.Image = upgradeSigns[luck.Value+1]
if luck.Value < 5 then
luckDisplay.price.Text = AbbreviateNumber:Abbreviate(luckPrices[luck.Value+1])
else
luckDisplay.price.Text = "Max"
end
acceleration.Changed:Connect(function()
accelerationDisplay.upgradeAmount.Image = upgradeSigns[acceleration.Value+1]
if acceleration.Value < 5 then
accelerationDisplay.price.Text = AbbreviateNumber:Abbreviate(accelerationPrices[acceleration.Value+1])
else
accelerationDisplay.price.Text = "Max"
end
end)
luck.Changed:Connect(function()
print(upgradeSigns[luck.Value+1])
luckDisplay.upgradeAmount.Image = upgradeSigns[luck.Value+1]
if luck.Value < 5 then
luckDisplay.price.Text = AbbreviateNumber:Abbreviate(luckPrices[luck.Value+1])
else
luckDisplay.price.Text = "Max"
end
end)
petStorage.Changed:Connect(function()
petStorageDisplay.upgradeAmount.Image = upgradeSigns[petStorage.Value+1]
if petStorage.Value < 5 then
petStorageDisplay.price.Text = AbbreviateNumber:Abbreviate(luckPrices[petStorage.Value+1])
else
petStorageDisplay.price.Text = "Max"
end
end)
So um, since the petStorage variable isnt changing where the else statement is, that might be where the issue is? plus. in the if statment, the Image isnt inside it but the Text is.
Possible Solution, if you want when the Data == 5 or, you can change the number so its exactly equal to 5 (or 6 since there is 6 images). you will know its maxed and the image should appear:
petStorage.Changed:Connect(function()
if petStorage.Value < 5 then
petStorageDisplay,upgradeAmount.Image = upgradeSigns[petStorage.Value+1]
petStorageDisplay.price.Text = AbbreviateNumber:Abbreviate(luckPrices[petStorage.Value+1])
else
petStorageDisplay.upgradeAmounts.Image = upgradeSigns[petStorage.Value = 6 ] -- or 5
petStorageDisplay.price.Text = "Max"
end
end)
The issue isn’t that the Image property doesn’t update with the correct image id, its that it does but doesn’t show the image, as you can see in this video.
Basically I just copied and pasted the id which was there originally to get the image to appear, the problem is that even with the correct id, the image doesn’t appear.
@YT_GamingDan
Interesting, I’m looking back at your code and the video, and that Image ID is not in the upgradeSigns Table, you may need to recheck it because that might be your issue.
or try copying the id. because i see 2 ID’s being put into the Image
Sorry I forgot to mention that I changed the id from the table, I was just reuploading the image just to make sure moderation wasn’t the problem but in that video I also had the 11242411223 id in the 6th place of the table too.