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

math.random how to choose multiple random numbers?

Asked by
iiKind 13
7 years ago

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?

0
do ---> ball.Size = Vector3.new(math.random(7,10), math.random(7,10), math.random(7,10)) Worthy0ne 68 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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

0
Thanks, it did point me into the right direction. iiKind 13 — 7y
0
Awesome Scriptinghelper1 15 — 7y
Ad

Answer this question