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

Anyone that can help me with this script that im testing (math.random) ?

Asked by 5 years ago
if (math.random(1,4)) > 2 then
    game.Workspace.Baseplate.BrickColor = BrickColor.new("Pastel green")
end

1 answer

Log in to vote
0
Answered by
Prestory 1395 Moderation Voter
5 years ago
Edited 5 years ago

You should define math.random() as a variable because it makes it easier to work with like i have done below.

local function BrickColorChange (Part)
    local RandomizedNumber = math.random(1,4)
    print(RandomizedNumber)
    if RandomizedNumber > 2 then
    Part.BrickColor = BrickColor.new("Pastel green")
    end
end

BrickColorChange(workspace.Baseplate)
0
Thats how you do a randomizer! thank you so much :D SchwarzWalde -12 — 5y
0
Np Prestory 1395 — 5y
Ad

Answer this question