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?
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]]--