Issue is - how would I make a part spawn on a part that spawned just prior to it?
I have a system where the green blocks spawn first, and then the yellow blocks are supposed to spawn right after, and hopefully in the newest spawned block.
Currently, it will spawn a single yellow before breaking the script.
I have tried using shared variables, along with a naming system that changes names after a piece is spawned. However, when I do this, it keeps spawning on only one block, or the times are off such so the script breaks.
I have 2 primary scripts and another script detecting the blocks.
Variables :
The NSVR is the green blocks, just rain. Instance A’s name changes to this after B is supposedly spawned.
The SVR is yellow, moderate rain. Spawned in as instance B.
“john” is a nickname when A is having B spawned on it. A spawns in as this, to get the newest spawned block to place B on.
ALSO,
How could I get the size of B to correspondent with A but to a half size of it? Thanks!
SCRIPT A
local nsvr = 0
--local svr = 100
repeat
nsvr += 2
local a = Instance.new("Part",workspace)
a.Position = Vector3.new(math.random(-200,-100),0.1,math.random(-200,-100))
a.BrickColor = BrickColor.new("Forest green")
a.Name = "john"
a.Anchored = true
a.Material = ("SmoothPlastic")
a.Size = Vector3.new(math.random(15,20), 0.1, math.random(15,20))
a.Name = nsvr
wait (1)
a.Name = nsvr
until nsvr == 100
SCRIPT B
repeat
local svr = 100
local nsvr = shared["joemama"]
wait (0.2)
local b = Instance.new("Part",workspace)
b.Position = Vector3.new(nsvr.position.X, nsvr.position.Y, nsvr.position.Z )
b.BrickColor = BrickColor.new("Deep orange")
b.Name = svr
b.Anchored = true
b.Material = ("SmoothPlastic")
b.Size = Vector3.new(math.random(3,5), 0.15, math.random(3,5))
svr += 1
until svr == 150
Thanks!