Hi, I am trying to make spawn a part near another part, i was using it to be random so when it spawn it does really near the target. Can someone got a answer to that?
✓ ANSWER ACCEPTED
How to position random around a certain object?
1 answer
✓ Accepted answer
if you want to make a part spawn near an another part you must :
Click on the part to know his position (I will say that it is at X = 0,Y = 0,Z = 0 to make it easier)
choose a radius for you new part to spawn (I will say 10 in each direction but it can be 1 000 000 ) So, you have your part and you want to spawn another one so you must begin your script with :
local RandomPart = Instance.new(“Part”) --The part is spawning
RandomPart.Parent = workspace --[[ here, i parented the part to the workspace, that mean that i have set the part in the workspace]]--
RandomPart.Name= “RandomPart” --[[The name of the part is now “RandomPart”]]--
local X = math.random(-10,10) --[[I set a variable between -10 and 10 on the X vector]]--
local Y = math.random(-10,10) --same for Y
local Z = math.random(-10,10)-- and for Z too
RandomPart.Position = Vector3.new(X,Y,Z) --[[I took the 3 variable and I put them in the RandomPart.Position with Vector3(it’s used for position in a 3D environement) you can find the RandomPart.Position by clicking on the part in the toolbox and searching for Position in the properties of the part]]--
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
I got trouble with editing but i finally finished xD
No, that doesn't work.
Also, you have WAY too many comments (or your comments are just WAY too long).
It's working for me so i'm quite surprised it isn't working for you but for the comments that's true ^^ ill try to make the comments more compact next time !
Thank you Louix, it's really helpful, i actually thought of that but never knew how to or if this was even possible ! :D
Thank you Louix, it's really helpful, i actually thought of that but never knew how to or if this was even possible ! :D
No problem Shematics good luck for your game!