I'm trying to create a block that clones itself at a postition infront while in 5 secs the old one deletes to stop the lag. BUT i'm having a problem (probably my terrible coding) the script works definitly but i can't seem to make the block always go infront of itself it only does it once and the rest are cloned there could i have some help?
Please use my block size and postition on an empty baseplate then paste the code below inside of the block to see how it works.
block size (11.96, 4.23, 67.3) block postition (-9.876, 2.115, 148.144)
wait(2) local NEWGEN = script.Parent:Clone() NEWGEN.Parent = game.Workspace NEWGEN.CFrame = CFrame.new(Vector3.new (-9.85, 2.12, 80.9)) wait(5) script.Parent:Remove()
local OldPart_CFrame = 0 while wait(2) do -- loop, but kinda crappy loop.. I dont like using a while loop; but whatev it works for now. local NEWGEN = script.Parent:Clone() NEWGEN.Parent = workspace OldPart_CFrame = NEWGEN.Position.Z -- Z Axis NEWGEN.CFrame = NEWGEN.CFrame * CFrame.new(0, 0, 12 +math.abs(-OldPart_CFrame/math.pi+2)) wait(5) script.Parent:Remove() end