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

math.random how to choose multiple random numbers?

So, i've tried to make a script where when a player joins, a ball appears. Everything is going out well except that the size doesn't randomize.

game.Players.PlayerAdded:connect(function(player)
	local ball = Instance.new("Part", workspace.Lobby)
	ball.Shape = Enum.PartType.Ball
	ball.Color = Color3.new(math.random(), math.random(), math.random())
	ball.Size = Vector3.new(math.random(7, 8, 9, 10), math.random(6, 7, 8, 9, 10), math.random(6, 7, 8, 9, 10))
	ball.Position = Vector3.new(0.5, 0.5, -0.5)
end)

what's the problem, the error says it has a wrong number of arrangements but i don't know what that means. How do i fix it?

1 comment

0

do ---> ball.Size = Vector3.new(math.random(7,10), math.random(7,10), math.random(7,10))

1 answer

✓ Accepted answer

I think the problem is that you have to many numbers for the size of the ball. Try using a local to define the random numbers like this:

local Y = math.random(1, 2, 3)

Then put:

Ball.Size = Y

Warning this is not the actual script I'm just pointing you in the right direction. Lemme know if this works

2 comments

0

Thanks, it did point me into the right direction.

0

Awesome

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