Advertisement
suremarc

Untitled

Sep 27th, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. function SetModelCFrame(model, cf, modelCF)
  2.     local modelCF = modelCF or (model.PrimaryPart and model.PrimaryPart.CFrame or model:GetModelCFrame());
  3.     local function recurse(o)
  4.         for _, child in ipairs(o:GetChildren()) do
  5.             recurse(child);
  6.         end
  7.         if o:IsA 'BasePart' then
  8.             o.CFrame = cf:toWorldSpace(modelCF:toObjectSpace(o.CFrame));
  9.         end
  10.     end
  11.     recurse(model);
  12. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement