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

Infinite generating blocks?

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()

3 comments

0

What way to you want it to move; X,Y,Z?

0

X

0

I ment Z

1 answer

✓ Accepted answer
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

4 comments

0

It is not exactly working correct. http://i.imgur.com/DAlASxD.png

0

It works much better now but now it generates to far infront for some reason over time could you fix this?

0

Nevermind i got it working thanks so much!

0

np

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