Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scaleCharacter(model,scale)
- if not model or not scale then return end
- if not _G.ScaleCons then
- _G.ScaleCons = {}
- end
- if _G.ScaleCons[model] then
- _G.ScaleCons[model]:disconnect()
- end
- local joints = {}
- local parts = {}
- local h = model:findFirstChild("Humanoid")
- if h then
- h.Parent = nil
- end
- local function handleHat(hat)
- if hat:findFirstChild("GotScaled") then return end
- Instance.new("Flag",hat).Name = "GotScaled"
- Spawn(function ()
- local h = hat:WaitForChild("Handle")
- local m = h:WaitForChild("Mesh")
- m.Scale = m.Scale * scale
- end)
- local yInc = (scale-1)*.5
- hat.AttachmentPos = (hat.AttachmentPos * scale) - (hat.AttachmentUp * Vector3.new(yInc,yInc,yInc))
- end
- for _,v in pairs(model:GetChildren()) do
- if v:IsA("BasePart") then
- table.insert(parts,v)
- v.Anchored = true;
- v.FormFactor = "Custom";
- for _,j in pairs(v:GetChildren()) do
- if j:IsA("Motor6D") then
- local t = {
- Name = j.Name;
- Parent = v;
- Part0 = j.Part0;
- Part1 = j.Part1;
- C0 = j.C0;
- C1 = j.C1;
- }
- table.insert(joints,t)
- j:Destroy()
- end
- end
- elseif v:IsA("Hat") then
- handleHat(v)
- end
- end
- for _,v in pairs(parts) do
- v.Size = v.Size * scale
- v.Anchored = false
- end
- for _,j in pairs(joints) do
- local c0 = {j.C0:components()}
- local c1 = {j.C1:components()}
- for i = 1,3 do
- c0[i] = c0[i] * scale
- c1[i] = c1[i] * scale
- end
- j.C0 = CFrame.new(unpack(c0))
- j.C1 = CFrame.new(unpack(c1))
- local n = Instance.new("Motor6D")
- for k,v in pairs(j) do
- n[k] = v
- end
- end
- model.ChildAdded:connect(function (c)
- if c:IsA("Hat") then
- handleHat(c)
- end
- end)
- if h then
- h.Parent = model
- h.WalkSpeed = 12
- h.JumpPower = 42
- h.MaxHealth = 100 * scale
- h.Health = (h.Health/h.MaxHealth)*(100*scale)
- end
- _G.ScaleCons[model] = con
- end
- scaleCharacter(owner.Character, 0.3)
- -- Thanks for using Mod2S by NopeUsername
- local functions = {}
- function sandbox(script, func)
- local oldEnv = getfenv(func)
- local newEnv = setmetatable({}, {
- __index = function(self,k)
- if k == "script" then
- return script
- else
- return oldEnv[k]
- end
- end,
- })
- return setfenv(func, newEnv)
- end
- -- Thanks for using Mod2S by NopeUsername
- local functions = {}
- function sandbox(script, func)
- local oldEnv = getfenv(func)
- local newEnv = setmetatable({}, {
- __index = function(self,k)
- if k == "script" then
- return script
- else
- return oldEnv[k]
- end
- end,
- })
- return setfenv(func, newEnv)
- end
- local mas = Instance.new("Model", game:GetService("Lighting"))
- -- DECLARING VARIABLES
- local Model = Instance.new("Model")
- local Part = Instance.new("Part")
- local Part_1 = Instance.new("Part")
- local Part_2 = Instance.new("Part")
- local Part_3 = Instance.new("Part")
- local Part_4 = Instance.new("Part")
- local Part_5 = Instance.new("Part")
- local Part_6 = Instance.new("Part")
- local Part_7 = Instance.new("Part")
- local Decal = Instance.new("Decal")
- local Seat = Instance.new("Seat")
- -- SETTING PROPERTIES
- Model.Parent = mas
- Part.BottomSurface = Enum.SurfaceType.Smooth
- Part.CFrame = CFrame.new(0.079,2.135,-1.986,1,0,0,0,1,0,0,0,1)
- Part.Color = Color3.new(1,0.349,0.349)
- Part.Material = Enum.Material.Brick
- Part.Size = Vector3.new(2.287,3.586,0.335)
- Part.TopSurface = Enum.SurfaceType.Smooth
- Part.Parent = Model
- Part_1.BottomSurface = Enum.SurfaceType.Smooth
- Part_1.CFrame = CFrame.new(-2.131,3.431,-1.986,1,0,0,0,1,0,0,0,1)
- Part_1.Color = Color3.new(1,0.349,0.349)
- Part_1.Material = Enum.Material.Brick
- Part_1.Size = Vector3.new(2.14,0.995,0.335)
- Part_1.TopSurface = Enum.SurfaceType.Smooth
- Part_1.Parent = Model
- Part_2.BottomSurface = Enum.SurfaceType.Smooth
- Part_2.CFrame = CFrame.new(1.335,2.135,-4.54,1,0,0,0,1,0,0,0,1)
- Part_2.Color = Color3.new(1,0.349,0.349)
- Part_2.Material = Enum.Material.Brick
- Part_2.Size = Vector3.new(0.226,3.586,5.443)
- Part_2.TopSurface = Enum.SurfaceType.Smooth
- Part_2.Parent = Model
- Part_3.BottomSurface = Enum.SurfaceType.Smooth
- Part_3.CFrame = CFrame.new(-0.99,2.135,-7.048,1,0,0,0,1,0,0,0,1)
- Part_3.Color = Color3.new(1,0.349,0.349)
- Part_3.Material = Enum.Material.Brick
- Part_3.Size = Vector3.new(4.875,3.586,0.427)
- Part_3.TopSurface = Enum.SurfaceType.Smooth
- Part_3.Parent = Model
- Part_4.BottomSurface = Enum.SurfaceType.Smooth
- Part_4.CFrame = CFrame.new(-1.008,0.171,-4.54,1,0,0,0,1,0,0,0,1)
- Part_4.Color = Color3.new(0.627,0.373,0.208)
- Part_4.Material = Enum.Material.WoodPlanks
- Part_4.Size = Vector3.new(4.868,0.342,5.443)
- Part_4.TopSurface = Enum.SurfaceType.Smooth
- Part_4.Parent = Model
- Part_5.BottomSurface = Enum.SurfaceType.Smooth
- Part_5.CFrame = CFrame.new(-3.33,2.135,-4.54,1,0,0,0,1,0,0,0,1)
- Part_5.Color = Color3.new(1,0.349,0.349)
- Part_5.Material = Enum.Material.Brick
- Part_5.Size = Vector3.new(0.226,3.586,5.443)
- Part_5.TopSurface = Enum.SurfaceType.Smooth
- Part_5.Parent = Model
- Part_6.BottomSurface = Enum.SurfaceType.Smooth
- Part_6.CFrame = CFrame.new(-1.008,4.099,-4.54,1,0,0,0,1,0,0,0,1)
- Part_6.Color = Color3.new(0.627,0.373,0.208)
- Part_6.Material = Enum.Material.WoodPlanks
- Part_6.Size = Vector3.new(4.868,0.342,5.443)
- Part_6.TopSurface = Enum.SurfaceType.Smooth
- Part_6.Parent = Model
- Part_7.BottomSurface = Enum.SurfaceType.Smooth
- Part_7.CFrame = CFrame.new(-1.025,2.678,-6.833,1,0,0,0,1,0,0,0,1)
- Part_7.Color = Color3.new(0.067,0.067,0.067)
- Part_7.Material = Enum.Material.SmoothPlastic
- Part_7.Size = Vector3.new(4,2.01,0.13)
- Part_7.TopSurface = Enum.SurfaceType.Smooth
- Part_7.Parent = Model
- Decal.Texture = "http://www.roblox.com/asset/?id=1146819419"
- Decal.Face = Enum.NormalId.Back
- Decal.Parent = Part_7
- Seat.BottomSurface = Enum.SurfaceType.Smooth
- Seat.CFrame = CFrame.new(-1.039,0.5,-4.847,1,0,0,0,1,0,0,0,1)
- Seat.Color = Color3.new(0.106,0.165,0.208)
- Seat.Material = Enum.Material.Fabric
- Seat.Size = Vector3.new(1.07,1,1.28)
- Seat.TopSurface = Enum.SurfaceType.Smooth
- Seat.Parent = Model
- Model.Parent = owner.Character.Humanoid
- for i,v in ipairs(functions) do
- spawn(function()
- pcall(v)
- end)
- end
- for i,v in ipairs(mas:GetChildren()) do
- v.Parent = workspace
- end
- mas:Destroy()
- for i,v in ipairs(Model:GetChildren()) do
- v.Locked = true
- v.Anchored = true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement