Hello! I am attempting to make a script that makes balls fall from the sky into random places, but I am getting an error. This is the function I am using.
function partyball() Ball = game.ServerStorage.PartyBall:Clone() Ball.Position = Vector3.new(math.random(-19, 82), 55, math.random(143, 113)) Ball.Parent = Workspace end
When this function runs, I get the following error in the output. Workspace.Party.Core Script:52: bad argument #2 to 'random' (interval is empty) I am not sure what is causing the problem, hopefully you can help. Thank you for taking your time to read this.
math.random(143, 113)
The lowest value should be given first, then follows the highest value
math.random(113, 143)
Other than that, it looks fine :)
Well i fixed it the only thing that was stopping the script from running for me was this ling here
Ball.Position = Vector3.new(math.random(-19,82),55,math.random(143,113)) --i switched the last numbers around to this math.random(143,200)) --i suspect that the first parameter has to be higher than the second one or it will not run also if you want multiple balls to fall from the sky you need to add either a while loop or a for loop function partyball() for i = 1,100 do -- switch to a while loop if you want Ball = game.ServerStorage.PartyBall:Clone() Ball.Position = Vector3.new(math.random(-19,82),55,math.random(143,200)) Ball.Parent = Workspace wait() end end partyball()
Locked by TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?