What I'm trying to do.
What I'm trying to do is constantly clone a model like a terrain generator and it keeps on generating in front of the other object that was cloned before.
What I already did.
I made a base object for the first one to be cloned from then the rest is suppose to clone in front of the one that was first cloned. Here was my attempt below.
Hope I explained this right. ~ KiHeros
local OldPart = workspace.Start while wait(.5) do local clone = game.ServerStorage.Defualt:Clone() clone.Parent = workspace clone:SetPrimaryPart(clone.Right.POP) clone.SetModelCFrame = OldPart.CFrame * CFrame.new(0, 0, clone.Right.POP.Size.z) clone:MakeJoints() OldPart = clone end
If you want to make the clone spawn in FRONT of the model I suggest using lookVector. Use SetPrimartyPartCFrame instead of SetModelCFrame.
I'll make an example for you. When a player joins, he teleports 10 studs backwards every 5 seconds.
game:GetService("Players").PlayerAdded:connect(function(plyr) plyr.CharacterAdded:connect(function(char) while wait(5) do char.Torso.CFrame = char.Torso.CFrame-char.Torso.CFrame.lookVector*10 end end) end)
It sets the primary part's cframe.
workspace.Model:SetPrimaryPartCFrame(CFrame.new(0,10,0))
local studs = 5 --How many studs forward the clone will be. local OldPart = workspace.Start while wait(.5) do local clone = game.ServerStorage.Defualt:Clone() clone.Parent = workspace clone.PrimaryPart = clone.Right.POP clone:SetPrimaryPartCFrame(OldPart.CFrame+OldPart.CFrame.lookVector*studs) clone:MakeJoints() OldPart = clone.Right.POP end
Hope this helps!