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

How to make an Instance.new position random?

Pretty self-explanatory.

2 answers

local part = Instance.new("Part", workspace)
part.Position = Vector3.new(math.random(1,100), math.random(-100,60), math.random(-5000, 10000))

2 comments

0

you can change the numbers to whatever you desire

0

Is there also a way I can make the character teleport to it?

math.randomseed(tick())
while true do
local part = workspace.Part
part.Position = Vector3.new(math.random(2000),2,math.random2000))
wait(1)
end

This script will generate a random position part within the coordinates (2000,2,2000) every second. Alas, but usually math.random() is a Pseudo random number generator, so to fix this we use math.randomseed()

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