Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a random x point for a volcano? [SOLVED]

Asked by 8 years ago

I have made a script(not even close to done) and when I make the x point random, it uses the same point each time. Here it is:

local serverstorage = game:GetService("ServerStorage")
local f = game.ServerStorage.Fire
local fCopy = f
local i = 1
local j = 1
local y = 0
local z = 15

repeat
    math.randomseed(tick())
    for _ = 0, 1 do
        x = (math.random(100))
        wait()
        break
    end

        print(x)
        f.Position = Vector3.new(x, y, z)
        local fCopy = f:Clone()
        fCopy.Parent = game.Workspace
        wait(.1)
        i = i + 1
        print(i)


until i==100
    repeat
    game.Workspace.Fire:Remove()
    j = j + 50
    until j == 1000

I also have the blocks disappear after about 10 seconds. I also have it print the x position and it turns up the same every time. Try to make the fix as simple as possible because I just started coding Lua a week ago.

0
I had the same problem awhile ago, the same time frame always uses the same (math.random), in a way its not completely random. Maybe you could make a script that makes the volcano when the first player to join the game moves, QuantumToast 261 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I think your problem is that you only passed 1 argument to math.random. Try this:

x = (math.random(0, 100))
0
And then i realize it's solved. Meh Winseven4lyf 30 — 8y
Ad

Answer this question