I'm making a mystery box so you can get power-ups like speed boost, health boost, and invincible boost. But when I touch the box it stops working. Here's the script.
for i=1,5 do for key, image in pairs(powerups) do end gui.Icon.Image = image --When it stops working wait(0.2) end giveBoost(player) end
Hello,
It appears that you have left the image assigner outside of your key, image
loop. To fix this, we simply rearrange the code:
for i=1,5 do for key, image in pairs(powerups) do gui.Icon.Image = image wait(0.2) end end giveBoost(player) end
This is important because the image
variable only exists within the key, image
loop.
Hopefully, this helped you solve your problem!
Cheers,
Chase