SHOW:
|
|
- or go back to the newest paste.
| 1 | wait() | |
| 2 | print("hi")
| |
| 3 | function gather(children, class, tab) | |
| 4 | local tab = tab and tab or {};
| |
| 5 | for _, child in pairs(children) do | |
| 6 | if child:IsA(class) then | |
| 7 | table.insert(tab, child); | |
| 8 | end; | |
| 9 | tab = gather(type(child) == "table" and child or child:GetChildren(), class, tab); | |
| 10 | end; | |
| 11 | return tab; | |
| 12 | end; | |
| 13 | ||
| 14 | function scaleModel(model, scalar) | |
| 15 | wait() | |
| 16 | -- what we will use for objectspace | |
| 17 | local center = model:GetModelCFrame(); | |
| 18 | -- things we need to scale | |
| 19 | local parts = gather(model:GetChildren(), "BasePart"); | |
| 20 | local meshes = gather(model:GetChildren(), "SpecialMesh"); | |
| 21 | local joints = gather(model:GetChildren(), "JointInstance"); | |
| 22 | -- prepare joints first because they will get messed up once we start repositioning/sizing | |
| 23 | local nJoints = {};
| |
| 24 | for _, joint in pairs(joints) do | |
| 25 | local scalar = tonumber(scalar) | |
| 26 | local scale0 = joint.C0.p * scalar; | |
| 27 | local scale1 = joint.C1.p * scalar; | |
| 28 | local r0 = joint.C0 - joint.C0.p; | |
| 29 | local r1 = joint.C1 - joint.C1.p; | |
| 30 | ||
| 31 | table.insert(nJoints, {
| |
| 32 | c0 = CFrame.new(scale0) * r0; | |
| 33 | c1 = CFrame.new(scale1) * r1; | |
| 34 | part0 = joint.Part0; | |
| 35 | part1 = joint.Part1; | |
| 36 | parent = joint.Parent; | |
| 37 | class = joint.ClassName; | |
| 38 | name = joint.Name; | |
| 39 | }); | |
| 40 | end; | |
| 41 | -- scale | |
| 42 | for _, part in pairs(parts) do | |
| 43 | local diff = (part.CFrame.p - center.p); | |
| 44 | local rotation = part.CFrame - part.CFrame.p; | |
| 45 | part.Size = part.Size * scalar; | |
| 46 | part.CFrame = CFrame.new(center.p + (diff * scalar)) * rotation; | |
| 47 | end; | |
| 48 | for _, mesh in pairs(meshes) do | |
| 49 | if mesh.MeshType == Enum.MeshType.FileMesh then | |
| 50 | local scale = mesh.Scale * scalar; | |
| 51 | mesh.Scale = mesh.Scale * scale; | |
| 52 | end; | |
| 53 | end; | |
| 54 | -- build joints | |
| 55 | for _, jdata in pairs(nJoints) do | |
| 56 | local joint = Instance.new(jdata.class, jdata.parent); | |
| 57 | joint.Part0 = jdata.part0; | |
| 58 | joint.Part1 = jdata.part1; | |
| 59 | joint.C0 = jdata.c0; | |
| 60 | joint.C1 = jdata.c1; | |
| 61 | joint.Name = jdata.name; | |
| 62 | end | |
| 63 | end | |
| 64 | - | local scale = 0.85 |
| 64 | + | local scale = 2 |
| 65 | local plrs = {}
| |
| 66 | function scalepeeps() | |
| 67 | for index, child in pairs(game:GetService'Players':GetChildren()) do | |
| 68 | if child:IsA("Player") then
| |
| 69 | if child.Character then | |
| 70 | scaleModel(child.Character,scale) | |
| 71 | local str = Instance.new("StringValue",child)
| |
| 72 | workspace.ChildRemoved:connect(function(c) | |
| 73 | if c.Name == child.Name then | |
| 74 | delay(1.5,function() scaleModel(child.Character,scale) end) | |
| 75 | end | |
| 76 | end) | |
| 77 | end | |
| 78 | end | |
| 79 | end | |
| 80 | game:GetService('Players').ChildAdded:connect(function(child)
| |
| 81 | if child:IsA("Player") then
| |
| 82 | if child.Character then | |
| 83 | scaleModel(child.Character,scale) | |
| 84 | workspace.ChildRemoved:connect(function(c) | |
| 85 | if c.Name == child.Name then | |
| 86 | delay(0.5,function() scaleModel(child.Character,scale) end) | |
| 87 | end | |
| 88 | end) | |
| 89 | end | |
| 90 | end | |
| 91 | end) | |
| 92 | end | |
| 93 | scalepeeps() |