First, you need math.randomseed(tick()) math.random() in one script that runs at the start of your place (and is never run a 2nd time). If you initialize a randomseed more than once, you'll reset how the random numbers are generated. ex, if you run the following script multiple times, it will always print out the same 3 values:
math.randomseed(1)
print(math.random())
print(math.random())
print(math.random())
0.56358531449324
0.19330423902097
0.80874050111393
So if each of your scripts tries to call math.randomseed and then you ask for a random number (or several random numbers), they will always turn out to be the same.
But if you do this script:
math.randomseed(tick())
print(math.random())
print(math.random())
print(math.random())
It will print out different values each run (so long as you start each run during a different second -- otherwise tick() will return the same thing). However, you might notice that the first value is similar each time. This is why you should always "throw away" the first random value after using randomseed. and is why the math.random() can go right after the call to randomseed.
As for your script, some notes:
- Using
morerandom doesn't really do anything. If you want there to be a 10% chance of something to happen, for instance, you should just do if math.random(1, 10) == 1 then or if math.random() <= 0.1 then
- You call :Clone() on line 7 but don't do anything with the result (which just destroys the Clone), though you probably don't need the line anyway as you already cloned something on line 6
- Note that you're supposed to assign the parent last (as it is significantly more efficient to assign the CFrame first, then set the parent). In this case, that means right before you destroy script.Parent.
2 comments
just test game in a server and not in studio
read my edit