Bomb Randomizer script not working help please


what is wrong with my code ?

yposition is inside of the vector3’s Z position.

You are writing math.random(-253.375, -253.275) (you write the same number twice, get rid of the minus on the second arg)

I Fixed what yall said to fix but it is still does not work.

Could you give us an example of what isn’t functioning as you want? Are you getting any output errors?
You should also update your OP with the most recent version of your code, so that we can narrow the issue down.

1 Like

I have done randomising drop from sky before
You might want to do

while true do
    -- Clone the bomb
    local x = math.random( -- Your positions on the x axis) 
    local z = math.random (-- Your positions on the z axis) 
    YourCloneVariable.CFrame = CFrame.new(x, YourYAxis, z) 
end

You can change the CFrame to vector 3. I just use CFrame whenever I position parts

Set the position first then you will parent the bomb.

Is there any difference between setting position then parent and setting parent then position? Just want to know cause I set parent then position

image
this is what i keep getting for the output

Bomb will spawn on correct position instead of spawning then changing positioning which looking not cool.

1 Like

Can you insert some print() into your script so that it is easier to identify the problems?


Okay so the error is on line number 7

The reason is because you cannot randomise from a bigger number to a smaller number. Try flipping the numbers around for both x and z
Edit: Example
Instead of math.random(number, - number) try math.random(-number,number)


Okay I did that now its saying there’s a error in line 9
sorry im asking a lot im really new to scripting

Hmmm, what if you use

BombCopy.CFrame = CFrame.new(xPosition, BombDropHight, zPosition)

?

The last line of the function has a problem I think
It shouldn’t be BombPart.Position

Oh okay wow im stupid i put BombCopy when the variable is BombPartCopy XD thank you all for you help.

1 Like