When player presses the button, a random item from the table and then executes some actions. The problem occurs when the player presses the button, they must press it twice for the actions to execute.
buyButton = script.Parent
funds = script.Parent.Parent.Parent.Funds
local Skins =
{633409829,
633412461,
}
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"
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.Text = "Accept"
end
if x == 633412461 and funds.Value > 25 then
buyButton.Parent.Cancel.Visible = false
buyButton.Parent.TextLabel.Text = "Processing"
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.Text = "Accept"
end
end)
