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

How do I make a script that will clone an object into a certain area only?

Asked by 6 years ago

I want to create a script that will spawn items only within a certain area. Say for example I clone a part from replicated storage but I only wanted it to be cloned randomly within the radius of another part.

0
Attempt: "make an effort to achieve or complete (something, typically a difficult task or action)." Axceed_Xlr 380 — 6y

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
6 years ago

In english: Set its position to the other parts position- offset by a random number capped at "radius". let's say flat.

In Lua:

--these are madeup variables you would have to create them
--radius is 50
newPart.Position = otherPart.Position + Vector3.new(math.random(50),0,math.random(50))

cheers there's not much to explain there. If you don't understand Vector3 then read up on wiki you'll get it

Ad

Answer this question