The goal is when a player presses a button, a random option is chosen and it runs some options according to which one is picked. The issue is, i only ever get the first number, the second two numbers never get chosen. Anyone know why(also, anyway i can optimize it?) Thanks
buyButton = script.Parent
funds = script.Parent.Parent.Parent.Funds
local Skins =
{633409829,
633412461,
633490575,
}
buyButton.MouseButton1Click:connect(function()
local x = Skins[math.random(1,#Skins)]
if x == 633409829 and funds.Value > 24 then
buyButton.Parent.Cancel.Visible = false
buyButton.Parent.TextLabel.Text = "Processing"
wait(3)
buyButton.Parent.TextLabel.Text = "Blossom Skin"
script.Parent.Parent.Image.Image = "rbxassetid://633409829"
script.Parent.Parent.Parent.Funds.Value = script.Parent.Parent.Parent.Funds.Value - 25
script.Parent.Parent.Parent.Parent.Skins.blossom.Value = true
script.Parent.Text = "Accept"
if x == 633412461 and funds.Value > 24 then
buyButton.Parent.Cancel.Visible = false
buyButton.Parent.TextLabel.Text = "Processing"
wait(3)
buyButton.Parent.TextLabel.Text = "Desert Camo"
script.Parent.Parent.Image.Image = "rbxassetid://633412461"
script.Parent.Parent.Parent.Funds.Value = script.Parent.Parent.Parent.Funds.Value - 25
script.Parent.Parent.Parent.Parent.Skins.desert.Value = true
script.Parent.Text = "Accept"
if x == 633490575 and funds.Value > 24 then
buyButton.Parent.Cancel.Visible = false
buyButton.Parent.TextLabel.Text = "Processing"
wait(3)
buyButton.Parent.TextLabel.Text = "Carbon Fiber"
script.Parent.Parent.Image.Image = "rbxassetid://633490575"
script.Parent.Parent.Parent.Funds.Value = script.Parent.Parent.Parent.Funds.Value - 25
script.Parent.Parent.Parent.Parent.Skins.carbon.Value = true
script.Parent.Text = "Accept"
end
end
end
end)

2 comments
Try replacing the 'if's after the first if x == blahblah with elseif
The way I see it, is that you have to replace the "if"'s after the first "if" with "elseif" ... also I believe you have two too many "end"'s