Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait()
- print("hi")
- function gather(children, class, tab)
- local tab = tab and tab or {};
- for _, child in pairs(children) do
- if child:IsA(class) then
- table.insert(tab, child);
- end;
- tab = gather(type(child) == "table" and child or child:GetChildren(), class, tab);
- end;
- return tab;
- end;
- function scaleModel(model, scalar)
- wait()
- -- what we will use for objectspace
- local center = model:GetModelCFrame();
- -- things we need to scale
- local parts = gather(model:GetChildren(), "BasePart");
- local meshes = gather(model:GetChildren(), "SpecialMesh");
- local joints = gather(model:GetChildren(), "JointInstance");
- -- prepare joints first because they will get messed up once we start repositioning/sizing
- local nJoints = {};
- for _, joint in pairs(joints) do
- local scalar = tonumber(scalar)
- local scale0 = joint.C0.p * scalar;
- local scale1 = joint.C1.p * scalar;
- local r0 = joint.C0 - joint.C0.p;
- local r1 = joint.C1 - joint.C1.p;
- table.insert(nJoints, {
- c0 = CFrame.new(scale0) * r0;
- c1 = CFrame.new(scale1) * r1;
- part0 = joint.Part0;
- part1 = joint.Part1;
- parent = joint.Parent;
- class = joint.ClassName;
- name = joint.Name;
- });
- end;
- -- scale
- for _, part in pairs(parts) do
- local diff = (part.CFrame.p - center.p);
- local rotation = part.CFrame - part.CFrame.p;
- part.Size = part.Size * scalar;
- part.CFrame = CFrame.new(center.p + (diff * scalar)) * rotation;
- end;
- for _, mesh in pairs(meshes) do
- if mesh.MeshType == Enum.MeshType.FileMesh then
- local scale = mesh.Scale * scalar;
- mesh.Scale = mesh.Scale * scale;
- end;
- end;
- -- build joints
- for _, jdata in pairs(nJoints) do
- local joint = Instance.new(jdata.class, jdata.parent);
- joint.Part0 = jdata.part0;
- joint.Part1 = jdata.part1;
- joint.C0 = jdata.c0;
- joint.C1 = jdata.c1;
- joint.Name = jdata.name;
- end
- end
- local scale = 2
- local plrs = {}
- function scalepeeps()
- for index, child in pairs(game:GetService'Players':GetChildren()) do
- if child:IsA("Player") then
- if child.Character then
- scaleModel(child.Character,scale)
- local str = Instance.new("StringValue",child)
- workspace.ChildRemoved:connect(function(c)
- if c.Name == child.Name then
- delay(1.5,function() scaleModel(child.Character,scale) end)
- end
- end)
- end
- end
- end
- game:GetService('Players').ChildAdded:connect(function(child)
- if child:IsA("Player") then
- if child.Character then
- scaleModel(child.Character,scale)
- workspace.ChildRemoved:connect(function(c)
- if c.Name == child.Name then
- delay(0.5,function() scaleModel(child.Character,scale) end)
- end
- end)
- end
- end
- end)
- end
- scalepeeps()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement