Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

1 comment

0

Attempt: "make an effort to achieve or complete (something, typically a difficult task or action)."

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.