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

How to make an Instance.new position random?

Asked by
JuanCema -10
6 years ago
Edited 6 years ago

Pretty self-explanatory.

2 answers

Log in to vote
0
Answered by 6 years ago
local part = Instance.new("Part", workspace)
part.Position = Vector3.new(math.random(1,100), math.random(-100,60), math.random(-5000, 10000))
0
you can change the numbers to whatever you desire thehybrid576 294 — 6y
0
Is there also a way I can make the character teleport to it? JuanCema -10 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
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()

Answer this question