So im rewriting my code for my generation for my backrooms game im making and i have assets that are single assets, i was wanting them to be randomly placed in random spots to make it different each time i was gonna make seeds that make different generation
1 Like
Easy! Use seeds!
In roblox studio there is something called
Random.new(seed of choice, an integer)
Link to page
One thing, to prevent it generating the same things, you should modify the seed so it differs. Something like
local seed=4
for i=1, (number of choice) do
local newPart=BasePart:Clone()
newPart.Orientation=Vector3.new(
0,
Random.new(seed+i):NextNumber(-360,360) -- + i removes the ability for every iteration to be the same, remove every "i" and watch what happens!
,0)
newPart.Position=Vector3.new(
Random.new(seed+i):NextNumber(-360,360)
,Random.new(seed+i):NextNumber(-1,1),
Random.new(seed+i):NextNumber(-350,350)) -- Made Z different from X, so both of them are not the same number.
newPart.Color=Color3.fromHSV(Random.new(seed+i):NextNumber(0,1)
,1
,1)
end
Let me know if it works or doesnt!