Of I’m trying to get the number of assets in game and do calculations but for some reason it gives me an error: “invalid argument #2 to ‘random’ (interval is empty)” when I print assets it prints a table but in my code I put # before assets so why wont it work?
local assests = workspace:GetChildren()
print(assests)
local s = math.random(100, #assests - 100)
local t = s + math.random(50,300)
local n = math.random(100, #assests - 100)
Try to print #assests and see how many you’ve got there.
Also try this :
local assests = workspace:GetChildren()
print(#assests) -- what does it print?
local s = math.random(100, #assests)
local t = s + math.random(50,300)
local n = math.random(100, #assests)
local assests = workspace:GetChildren()
print(#assests) -- what does it print?
local s = math.random(100, #assests)
local t = s + math.random(50,300)
local n = math.random(100, #assests)
print(s,t,n) -- prints?
Does this code work to you?
(Also a side note for general :
the second argument in math.random has to be greated than the first one)