Admins/Moderators, please do not close this and redirect me to "https://scriptinghelpers.org/questions/1485/c-framing-a-model-to-a-exact-vector3-position". That works to move my model, but it completely rotated it and made it face down into the floor. I'm serious, I'm on the verge of calling this project canceled.
Here is the code and the issue shown with pictures.
function GenerateCar() --pcall(function() LastCar:Destroy() end) script.Parent.Gen.BillboardGui.Frame.Visible=true script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Covering Area." local clone=game.ServerStorage.Car:clone() --Special CFramer do local modelCF=clone:GetModelCFrame() local targetCFrame=script.Parent.Cover.CFrame for i,v in pairs(clone:getChildren()) do if v:IsA("BasePart") then v.CFrame=targetCFrame:toWorldSpace(modelCF:toObjectSpace(v.CFrame)) end end end --End of Special CFramer clone.Archivable=false wait() for a=.2,8.2,.2 do script.Parent.Cover.Size=Vector3.new(18,a,10) script.Parent.Cover.CFrame=script.Parent.Part.CFrame+Vector3.new(0,a/2,0) wait() end wait(.8) script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Generating Car." wait(.8) local model=Instance.new("Model",Workspace) model.Name="TCar" LastPos=clone.VehicleSeat.Position local all=clone:getChildren() for a=1,#all do if all[a]:IsA("BasePart") then all[a].Anchored=true end all[a].Parent=model wait() end model:MakeJoints() script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Uncovering." wait(.8) --Continues on, but the problem occurs above.
Here is the image when the spawner finishes. Don't worry about the anchored parts, as its used for demonstrational purposes. http://postimg.org/image/y99n8bsbx/
Here. I tried the MoveTo() event. If this does not work then I will try a different remedy.
function GenerateCar() --pcall(function() LastCar:Destroy() end) script.Parent.Gen.BillboardGui.Frame.Visible=true script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Covering Area." local clone=game.ServerStorage.Car:clone() --Special CFramer do local v = clone:getChildren() local modelCF=clone:GetModelCFrame() local targetCFrame=script.Parent.Cover.CFrame for i= 1,#v do if v[i]:IsA("BasePart") then v[i].CFrame=targetCFrame:MoveTo(modelCF:MoveTo(v[i].CFrame)) end end end --End of Special CFramer clone.Archivable=false wait() for a=.2,8.2,.2 do script.Parent.Cover.Size=Vector3.new(18,a,10) script.Parent.Cover.CFrame=script.Parent.Part.CFrame+Vector3.new(0,a/2,0) wait() end wait(.8) script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Generating Car." wait(.8) local model=Instance.new("Model",Workspace) model.Name="TCar" LastPos=clone.VehicleSeat.Position local all=clone:getChildren() for a=1,#all do if all[a]:IsA("BasePart") then all[a].Anchored=true end all[a].Parent=model wait() end end model:MakeJoints() script.Parent.Gen.BillboardGui.Frame.TextLabel.Text="Uncovering." wait(.8)