I believe you mean that it will move the model above where you want it, because ROBLOX tends to do that. There are a few ways to do this. If you haven't already, read up on the CFrame wiki page. This will be invaluable in the script.
The first thing we'll need to do is use the method "GetModelCFrame". This gets the CFrame for the model. We'll set "modelCF" to it.
1 | modelCF = car:GetModelCFrame() |
Next, we have to figure out where we want to move it to. It should be a CFrame. We'll set "targetCFrame" to "pad.CFrame".
Now we have to move the parts. The way you do this will vary depending on the model structure; this is the simple way. If you have submodels with parts in them, this method won't work, and you'll need recursion. We'll get the relative CFrame from modelCF to the part's CFrame, and then use that relation to move it to targetCFrame.
1 | for i,v in pairs (car:children()) do |
2 | if v:IsA( "BasePart" ) then |
3 | v.CFrame = targetCFrame:toWorldSpace(modelCF:toObjectSpace(v.CFrame)) |
This should complete the move. You can, of course, define a more general function:
1 | function moveModel(model,targetCFrame) |
2 | for i,v in pairs (car:children()) do |
3 | if v:IsA( "BasePart" ) then |
4 | v.CFrame = targetCFrame:toWorldSpace(model:GetModelCFrame():toObjectSpace(v.CFrame)) |
9 | moveModel(car,pad.CFrame) |
You could also use recursion to get the parts inside of submodels, as mentioned before.