Would be helpful to keep things tidy in the future ^
weird, try this v
local events = {}
function Explode()
--code here
end
table.insert(events,Explode)
local event = math.random(1,#events)
events[event](player)
Would be helpful to keep things tidy in the future ^
weird, try this v
local events = {}
function Explode()
--code here
end
table.insert(events,Explode)
local event = math.random(1,#events)
events[event](player)
Alright, I went with @CleverSource’s answer, it’ll be good for adding more “events” in the future!
Just a heads up that the Start function of an Aero Service only runs once. Unless you’ve got this code running in your round loop that’s also enclosed within Start, this will only happen once as in when it’s called. I’m going to go ahead and assume that you’re doing this right anyway.
A loop is pointless overhead in this scenario. It doesn’t solve the question nor does it fix the problem specified in the OP. The loop doesn’t even do anything in the first place except call math.random and throw away the returned value.
I find it’d do you justice to look up information on the # (length) unary operator. It counts everything inside a table provided it’s not a dictionary (non-numeric indices). The reason why this works is because math.random gets a number from 1-#t and returns the value at the indice n.
I’m not sure if you know this or not, but I’ll just drop this here. Others may find that information useful.
Why would you need to use DataStores here? Please understand the topic you’re reading before replying. DataStores are meant for storing data as the name implies. They’re completely irrelevant here.
Yeah, I have it wrapped in a while loop. I was experimenting around with the framework this morning and have mostly figured it out.