Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 answer

✓ Accepted answer

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)

2 comments

0

Thats how you do a randomizer! thank you so much :D

0

Np

This discussion is preserved as it was. New answers, comments, and votes are closed.