Hello! I'm working on a pre-developed stock trading system script. here is what I have so far:
local be = script.Parent.BE
local m = script.Parent.M
local octan = script.Parent.Octan
while true do
c = game.Players:GetChildren()
for i=1, #c do
local frame = c[i].PlayerGui:findFirstChild("ScreenGui"):findFirstChild("StockMsg")
frame.Visible = true
end
math.randomseed(tick())
local newCostO = math.random(1,1000)-math.random(1,1000)
wait(1)
local newCostM = math.random(2500,5000)-math.random(2500,5000)
wait(1)
local newCostB = math.random(700,1500) - math.random(700,1500)
be.Value = newCostB if newCostB > 1500
then newCostB = 1499
m.Value = newCostM if newCostM > 5000
then newCostM = 4999
octan.Value = newCostO if newCostO > 1000 then newCostO = 999
wait(3)
for i=1, #c do
local frame = c[i].PlayerGui:findFirstChild("ScreenGui"):findFirstChild("StockMsg")
frame.Visible = false
end
end
end
end
wait(30)
end
I'm trying to change the local 'newcostX' to a random value without going beyond a cap. hence the 2 math.random's When running the script in game, it seems to freeze the script and doesnt go past where it shows the changed values. Does this read correctly? I believe I messed up the if/then statements or there is another script somewhere in my Workplace that isnt syncing properly with this one
