What can I do to make this script more neat?
local function price()
local RandomNumber1 = Random.new():NextNumber(3,5)
local RandomNumber2 = Random.new():NextNumber(3,5)
local RandomNumber3 = Random.new():NextNumber(3,5)
local places = 2
local number = RandomNumber1
local mult = 10^places
number = math.floor(number*mult)/mult
local places = 2
local number2 = RandomNumber2
local mult = 10^places
number2 = math.floor(number2*mult)/mult
local places = 2
local number3 = RandomNumber3
local mult = 10^places
number3 = math.floor(number3*mult)/mult
script.Parent.Shop1.PriceVal.Value = number
script.Parent.Shop2.PriceVal.Value = number2
script.Parent.Shop3.PriceVal.Value = number3
script.Parent.Shop1.Price.PlayerName.Text = "$"..number
script.Parent.Shop2.Price.PlayerName.Text = "$"..number2
script.Parent.Shop3.Price.PlayerName.Text = "$"..number3
end
db = false
local function Sell(Name, Price)
if db == false then
local gameStats = game.Players:FindFirstChild(Name).leaderstats
if gameStats.Pumpkins.Value >=1 then
db = true
script.Parent.Sell:Play()
gameStats.Coins.Value = gameStats.Coins.Value + Price
gameStats.Pumpkins.Value = gameStats.Pumpkins.Value - 1
wait(0.1)
db = false
else
db = false
end
end
end
script.Parent.Shop1.ClickDetector.MouseClick:Connect(function(plr)
Sell(plr.Name, script.Parent.Shop1.PriceVal.Value)
end)
script.Parent.Shop2.ClickDetector.MouseClick:Connect(function(plr)
Sell(plr.Name, script.Parent.Shop1.PriceVal.Value)
end)
script.Parent.Shop3.ClickDetector.MouseClick:Connect(function(plr)
Sell(plr.Name, script.Parent.Shop1.PriceVal.Value)
end)
price()
while true do
wait(20)
price()
end