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

Infinite generating blocks?

Asked by
Hero_ic 502 Moderation Voter
9 years ago

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()
0
What way to you want it to move; X,Y,Z? MessorAdmin 598 — 9y
0
X Hero_ic 502 — 9y
0
I ment Z Hero_ic 502 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago
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
0
It is not exactly working correct. http://i.imgur.com/DAlASxD.png Hero_ic 502 — 9y
0
It works much better now but now it generates to far infront for some reason over time could you fix this? Hero_ic 502 — 9y
0
Nevermind i got it working thanks so much! Hero_ic 502 — 9y
0
np MessorAdmin 598 — 9y
Ad

Answer this question