DevKxnq1221

Untitled

Sep 23rd, 2019
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. function shrink(character, scale)
  2.     if not character or not scale then return end
  3.    
  4.     --local cframe = character.Torso.CFrame
  5.    
  6.     local joints = {}
  7.     local h = character:findFirstChild("Humanoid")
  8.    
  9.     if h then
  10.         h.Parent = nil
  11.     end
  12.    
  13.     for _,v in pairs(character:GetChildren()) do
  14.         if v:IsA("BasePart") or v:IsA("UnionOperation") then
  15.             for _,j in pairs(v:GetChildren()) do
  16.                 if j:IsA("Motor6D") or j:IsA("ManualWeld") then
  17.                     --print(j)
  18.                     local t = {
  19.                         Name = j.Name;
  20.                         Parent = v;
  21.                         Part0 = j.Part0;
  22.                         Part1 = j.Part1;
  23.                         C0 = j.C0;
  24.                         C1 = j.C1;
  25.                     }
  26.                     table.insert(joints,t)
  27.                     j:Destroy()
  28.                 end
  29.             end
  30.         elseif v:IsA("Part") then
  31.             v.FormFactor = "Custom";
  32.             v.Size = v.Size * scale
  33.             v.Anchored = false
  34.         elseif v:IsA("UnionOperation") then
  35.             v.Size = v.Size * scale
  36.             v.Anchored = false
  37.         end
  38.         character.torso.FormFactor = "Custom"
  39.         character.torso.Size = character.torso.Size * scale
  40.     end
  41.    
  42.     for _,j in pairs(joints) do
  43.         local c0 = {j.C0:components()}
  44.         local c1 = {j.C1:components()}
  45.         for i = 1,3 do
  46.             c0[i] = c0[i] * scale
  47.             c1[i] = c1[i] * scale
  48.         end
  49.         j.C0 = CFrame.new(unpack(c0))
  50.         j.C1 = CFrame.new(unpack(c1))
  51.         local n = Instance.new("Motor6D")
  52.         for k,v in pairs(j) do
  53.             n[k] = v
  54.         end
  55.     end
  56.    
  57.      if h then
  58.         h.Parent = character
  59.         h.WalkSpeed = 16 * scale
  60.         h.MaxHealth = 1*scale*105
  61.         wait()
  62.         h.Health = h.MaxHealth
  63.         h.DisplayDistanceType = "None"
  64.     end
  65.    
  66.     --character.Torso.CFrame = cframe
  67. end
  68.  
  69. local sp = script.Parent
  70.  
  71.  
  72. sp.Touched:connect(function(hit)
  73.     local character = hit.Parent
  74.    
  75.     if character:FindFirstChild("Humanoid") then
  76.         if not character:FindFirstChild("Check") then
  77.             if character:FindFirstChild("Chest") then
  78.                 for _,v in pairs(character:FindFirstChild("Chest"):GetChildren()) do
  79.                     v.Parent = character
  80.                 end
  81.             end
  82.             shrink(character,1.14)
  83.             local check = Instance.new("BoolValue",character)
  84.             check.Name = "Check"
  85.         end
  86.     end
  87. end)
Advertisement
Add Comment
Please, Sign In to add comment