Hello everyone,
I have this shop code and it works fine. However, it’s quite messy. How would I simplify it?
if tonumber(Amount.Text) and Storage.Value >= tonumber(Amount.Text) and Gold.Value >= (tonumber(Amount.Text) * 5) then
event:FireServer(tonumber(Amount.Text),"Buying")
Amount.Text = ""
elseif tonumber(Amount.Text) == nil then
Amount.Text = ""
TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
TextLabel.Text = "Numbers can only be enterd in this box"
button.Active = false
wait(2)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
TextLabel.Text = "Type The Amount of stone You want to buy:"
button.Active = true
elseif Storage.Value < tonumber(Amount.Text) and Gold.Value >= (tonumber(Amount.Text) * 5) then
Amount.Text = ""
TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
TextLabel.Text = "The amount of stone you orderd isn't avalibale"
button.Active = false
wait(2)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
TextLabel.Text = "Type The Amount of stone You want to buy:"
button.Active = true
elseif Gold.Value < (tonumber(Amount.Text) * 5) then
Amount.Text = ""
TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
TextLabel.Text = "You don't have enough Gold to buy that amount"
button.Active = false
wait(2)
TextLabel.TextColor3 = Color3.fromRGB(255,255,255)
TextLabel.Text = "Type The Amount of stone You want to buy:"
button.Active = true
thank you