Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- function findFirstMatchingAttachment(model, name)
- for _, child in pairs(model:GetChildren()) do
- if child:IsA("Attachment") and child.Name == name then
- return child
- elseif not child:IsA("Accoutrement") and not child:IsA("Tool") then -- don't look in hats or tools in the character
- local foundAttachment = findFirstMatchingAttachment(child, name)
- if foundAttachment then
- return foundAttachment
- end
- end
- end
- end
- local function getOriginalProperty(obj, property)
- local origPropertyValue = obj:FindFirstChild("OriginalProperty" ..property)
- if not origPropertyValue then
- origPropertyValue = Instance.new("Vector3Value")
- origPropertyValue.Name = "OriginalProperty" ..property
- origPropertyValue.Value = property and obj[property]
- origPropertyValue.Parent = obj
- end
- return origPropertyValue.Value
- end
- local function findHandleMesh(handle)
- for _, obj in pairs(handle:GetChildren()) do
- if obj:IsA("DataModelMesh") then
- return obj, getOriginalProperty(obj, "Scale")
- end
- end
- end
- local function buildWeld(weldName, parent, part0, part1, c0, c1)
- local weld = Instance.new("Weld")
- weld.Name = weldName
- weld.Part0 = part0
- weld.Part1 = part1
- weld.C0 = c0
- weld.C1 = c1
- weld.Parent = parent
- end
- local function getAccoutrementWeld(attachmentPart, handle)
- local accessoryWeld = handle:FindFirstChild("AccessoryWeld")
- if accessoryWeld then
- return accessoryWeld
- end
- -- Legacy case
- for _, obj in pairs(attachmentPart:GetChildren()) do
- if obj:IsA("Weld") then
- if obj.Part0 == handle or obj.Part1 == handle then
- return obj
- end
- end
- end
- return nil
- end
- -- Get what part an accoutrement is attached to
- local function getAttachedPart(accessory, character)
- local handle = accessory:FindFirstChild("Handle")
- if handle then
- local accoutrementAttachment = handle:FindFirstChildOfClass("Attachment")
- local characterAttachment = accoutrementAttachment and findFirstMatchingAttachment(character, accoutrementAttachment.Name) or nil
- local attachmentPart = characterAttachment and characterAttachment.Parent or character:FindFirstChild("Head")
- return attachmentPart
- end
- return nil
- end
- local function rescaleAccessory(accessory, character, bodyScaleVector, headScale)
- local handle = accessory:FindFirstChild("Handle")
- if not handle then
- return
- end
- local originalSize = getOriginalProperty(handle, "Size")
- local currentScaleVector = handle.Size/originalSize
- local desiredScaleVector = bodyScaleVector
- local accoutrementAttachment = handle:FindFirstChildOfClass("Attachment")
- local characterAttachment = accoutrementAttachment and findFirstMatchingAttachment(character, accoutrementAttachment.Name) or nil
- local attachmentPart = characterAttachment and characterAttachment.Parent or character:FindFirstChild("Head")
- if not attachmentPart then
- return
- end
- local accoutrementWeld = getAccoutrementWeld(attachmentPart, handle)
- if attachmentPart.Name == "Head" then
- desiredScaleVector = Vector3.new(headScale, headScale, headScale)
- end
- local modifyVector = desiredScaleVector/currentScaleVector
- -- Modify the size of the attachment and handleMesh
- handle.Size = handle.Size * modifyVector
- local handleMesh, origMeshScale = findHandleMesh(handle)
- if handleMesh then
- handleMesh.Scale = origMeshScale * desiredScaleVector
- end
- -- This resizes the Attachment and the legacy AttachmentPoint property
- if accoutrementAttachment then
- -- Accessory case is easier
- accoutrementAttachment.Position = getOriginalProperty(accoutrementAttachment, "Position") * desiredScaleVector
- end
- -- Legacy hat logic case
- local x, y, z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = accessory.AttachmentPoint:components()
- x, y, z = x * modifyVector.x, y * modifyVector.y, z * modifyVector.z
- accessory.AttachmentPoint = CFrame.new(
- x, y, z,
- R00, R01, R02,
- R10, R11, R12,
- R20, R21, R22
- )
- local attachmentCFrame = characterAttachment and characterAttachment.CFrame or CFrame.new(0, 0.5 * headScale, 0)
- local hatCFrame = accoutrementAttachment and accoutrementAttachment.CFrame or accessory.AttachmentPoint
- if accessory:IsA("Hat") and not accoutrementWeld.Parent == handle then
- -- This is using the legacy hat attachment sytem
- buildWeld("HeadWeld", attachmentPart, attachmentPart, handle, attachmentCFrame, hatCFrame)
- else
- -- Reparent the accessory to properly weld it to the character
- accessory.Parent = nil
- accessory.Parent = character
- end
- end
- local function rescaleAccessories(character, bodyScaleVector, headScale)
- local humanoid = character:FindFirstChildOfClass("Humanoid")
- for _, obj in pairs(character:GetChildren()) do
- if obj:IsA("Accoutrement") then
- if RunService:IsServer() then
- rescaleAccessory(obj, character, bodyScaleVector, headScale)
- else
- -- We need to wait for character size to change
- local attachedPart = getAttachedPart(obj, character)
- local currentSize = attachedPart.Size
- local anyChanged, xChanged, yChanged, zChanged = false, false, false, nil
- if attachedPart then
- coroutine.wrap(function()
- local sizeChangedConnection;
- sizeChangedConnection = attachedPart.Changed:connect(function(property)
- if property == "Size" then
- anyChanged = true
- if currentSize.X ~= attachedPart.Size.X then
- xChanged = true
- end
- if currentSize.Y ~= attachedPart.Size.Y then
- yChanged = true
- end
- if currentSize.Z ~= attachedPart.Size.Z then
- zChanged = true
- end
- end
- if xChanged and yChanged and zChanged then
- sizeChangedConnection:disconnect()
- sizeChangedConnection = nil
- rescaleAccessory(obj, character, bodyScaleVector, headScale)
- end
- end)
- -- Clean up the connection if it isn't already disconnected
- wait(0.5)
- if sizeChangedConnection then
- sizeChangedConnection:disconnect()
- end
- end)()
- end
- end
- end
- end
- end
- local remote = owner:FindFirstChild("chickennuggetbuttscale")
- if remote == nil then remote = Instance.new("RemoteEvent",owner) remote.Name = "chickennuggetbuttscale" end
- remote.OnServerEvent:Connect(function(plr,scale,body)
- local character = plr.Character
- local num = tonumber(scale)
- local humanoid = character:FindFirstChild("Humanoid")
- if humanoid and num ~= nil then
- if humanoid:FindFirstChild("BodyHeightScale") then
- humanoid.BodyHeightScale.Value = body[1]*num
- end
- if humanoid:FindFirstChild("BodyWidthScale") then
- humanoid.BodyWidthScale.Value = body[2]*num
- end
- if humanoid:FindFirstChild("BodyDepthScale") then
- humanoid.BodyDepthScale.Value = body[3]*num
- end
- if humanoid:FindFirstChild("HeadScale") then
- humanoid.HeadScale.Value = body[4]*num
- end
- plr.CameraMaxZoomDistance = 128*num
- plr.CameraMinZoomDistance = 0.5*num
- rescaleAccessories(character, num*body[1], body[4]*num)
- for i,v in pairs(owner.Backpack:GetDescendants()) do
- if v:IsA("BasePart") then
- local g = v:FindFirstChild("realtimescale")
- if g == nil then
- g = Instance.new("Vector3Value",v)
- g.Name = "realtimescale"
- g.Value = v.Size
- end
- end
- end
- for i,v in pairs(owner.Backpack:GetDescendants()) do
- if v:IsA("BasePart") and v:FindFirstChild("realtimescale") ~= nil then
- v.Size = v.realtimescale.Value * Vector3.new(scale,scale,scale)
- end
- end
- end
- end)
- NLS([[
- script.Parent = game.Players.LocalPlayer.PlayerScripts
- local locked = false
- local cam = workspace.CurrentCamera
- cam.CameraType = Enum.CameraType.Scriptable
- local runService = game:GetService("RunService")
- local userInputService = game:GetService("UserInputService")
- local deltaa = Vector2.new(0,0)
- local zoom = 10
- local sens = 0.0125
- local scale = 1
- local firstperson = false
- local zoomed = false
- repeat wait() until game.Players.LocalPlayer.Character:FindFirstChild("Head") ~= nil and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil
- local subtraction = game.Players.LocalPlayer.Character.Head.Position.Y - game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y
- local Search
- function Search(Parent, Function)
- for Index, Object in next, Parent:children() do
- pcall(function()
- Function(Object)
- end)
- Search(Object, Function)
- end
- end
- function showchar(char)
- coroutine.resume(coroutine.create(function()
- local Character = char
- Search(Character, function(Object)
- if (Object:IsA'BasePart' or Object:IsA'Decal') and Object.Name ~='HumanoidRootPart' then
- Object.Transparency = 0
- end
- end)
- end))
- end
- function hidechar(char)
- coroutine.resume(coroutine.create(function()
- local Character = char
- Search(Character, function(Object)
- if (Object:IsA'BasePart' or Object:IsA'Decal') and Object.Name ~='HumanoidRootPart' then
- Object.Transparency = 1
- end
- end)
- end))
- end
- coroutine.resume(coroutine.create(function()
- while wait() do
- if game.Players.LocalPlayer.Character:FindFirstChild("Head") ~= nil and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil then
- if scale ~= game.Players.LocalPlayer.Character.Head.Size.Y then
- scale = game.Players.LocalPlayer.Character.Head.Size.Y
- subtraction = game.Players.LocalPlayer.Character.Head.Position.Y - game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y
- end
- end
- end
- end))
- local function OnRenderStep()
- if game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil then
- if zoom > 0.65 then
- local delta = userInputService:GetMouseDelta()
- cam.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(0,subtraction,0))
- delta = Vector2.new((delta.X*sens),(delta.Y*sens))
- deltaa = deltaa + (delta*Vector2.new(-1,-1))
- cam.CFrame = cam.CFrame * CFrame.Angles(0,deltaa.X,0) * CFrame.Angles(deltaa.Y,0,0) * CFrame.new(0,0,(zoom * (scale/1)))
- else
- local delta = userInputService:GetMouseDelta()
- cam.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(0,subtraction,0))
- delta = Vector2.new((delta.X*sens),(delta.Y*sens))
- deltaa = deltaa + (delta*Vector2.new(-1,-1))
- cam.CFrame = cam.CFrame * CFrame.Angles(0,deltaa.X,0) * CFrame.Angles(deltaa.Y,0,0)
- end
- end
- end
- runService:BindToRenderStep("MeasureMouseMovement", Enum.RenderPriority.Input.Value, OnRenderStep)
- userInputService.InputBegan:Connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseButton2 and not gameProcessed and zoom > 0.65 then
- userInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
- elseif input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
- if input.KeyCode == Enum.KeyCode.Z and firstperson then
- workspace.CurrentCamera.FieldOfView = 10
- sens = 0.0125/10
- zoomed = true
- end
- end
- end)
- userInputService.InputEnded:Connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseButton2 and not gameProcessed and zoom > 0.65 then
- userInputService.MouseBehavior = Enum.MouseBehavior.Default
- elseif input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
- if input.KeyCode == Enum.KeyCode.Z and zoomed then
- workspace.CurrentCamera.FieldOfView = 70
- sens = 0.0125
- zoomed = false
- end
- end
- end)
- userInputService.InputChanged:Connect(function(input, gameProcessed)
- if input.UserInputType == Enum.UserInputType.MouseWheel then
- if not zoomed then
- if zoom + (input.Position.Z * -1 * (zoom/7)) >= 0 then
- if zoom > 0.65 or input.Position.Z == -1 then
- zoom = zoom + input.Position.Z * -1 * (zoom/7)
- if zoom <= 0.65 and game.Players.LocalPlayer.Character:FindFirstChild("Head").Transparency ~= 1 then
- hidechar(game.Players.LocalPlayer.Character)
- userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
- firstperson = true
- elseif game.Players.LocalPlayer.Character:FindFirstChild("Head").Transparency ~= 0 then
- showchar(game.Players.LocalPlayer.Character)
- userInputService.MouseBehavior = Enum.MouseBehavior.Default
- firstperson = false
- end
- end
- end
- else
- workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + ((input.Position.Z*-1)/2)
- sens = (workspace.CurrentCamera.FieldOfView/10) * (0.0125/10)
- end
- end
- end)
- wait(1.1)
- local plr = game.Players.LocalPlayer
- local body = plr.Character.Humanoid.BodyHeightScale.Value
- local bodyw = plr.Character.Humanoid.BodyWidthScale.Value
- local bodyd = plr.Character.Humanoid.BodyDepthScale.Value
- local heads = plr.Character.Humanoid.HeadScale.Value
- local nearplanez = workspace.CurrentCamera.NearPlaneZ
- local remote = plr:WaitForChild("chickennuggetbuttscale")
- workspace.Gravity = 0
- function changeScale(scale)
- remote:FireServer(scale,{body,bodyw,bodyd,heads})
- workspace.CurrentCamera.CameraSubject = plr.Character.Head--workspace:WaitForChild('ViewPart')
- local density = .3*500
- local friction = 100
- local elasticity = 0
- local frictionWeight = 10
- local elasticityWeight = 0
- -- Construct new PhysicalProperties and set
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- for i,part in pairs(plr.Character:GetDescendants()) do
- if part:IsA("BasePart") and part.Name ~= "Head" then
- part.CustomPhysicalProperties = physProperties
- end
- end
- plr.Character.Humanoid.WalkSpeed = 16*tonumber(scale)
- plr.Character.Humanoid.JumpPower = 50*tonumber(scale)
- plr.Character.Animate.ScaleDampeningPercent.Value = 1
- local bf = plr.Character.HumanoidRootPart:FindFirstChild("BodyForce")
- if bf == nil then
- bf = Instance.new("BodyForce",plr.Character.HumanoidRootPart)
- end
- bf.Force = Vector3.new(0,(-350*500)*((tonumber(scale))^3.9),0)
- wait()
- wait()
- end
- wait()
- changeScale(1)
- plr.Chatted:Connect(function(msg)
- local split = string.split(msg," ")
- if string.lower(split[1]) == "/e" and string.lower(split[2]) == "scale" then
- if tonumber(split[3]) ~= nil then
- changeScale(tonumber(split[3])-0.01)
- wait(.1)
- changeScale(tonumber(split[3]))
- end
- end
- end)]],owner.PlayerGui)
- NLS([[local player = game.Players.LocalPlayer
- local bin = Instance.new("HopperBin",player.Backpack)
- bin.Name = "Fly"
- script.Parent = bin
- local char = player.Character
- local torso = char:FindFirstChild("HumanoidRootPart")
- local seleted = false
- local pos, gyro;
- local UserInputService = game:GetService("UserInputService")
- bin.Selected:connect(function(mouse)
- selected = true
- pos = Instance.new("BodyPosition", torso)
- pos.maxForce = Vector3.new(1,1,1) * 1e99
- pos.position = torso.Position
- gyro = Instance.new("BodyGyro", torso)
- gyro.maxTorque = Vector3.new(1,1,1) * 1e99
- local angle = CFrame.new()
- touchstart = UserInputService.TouchStarted:connect(function()
- button_up = false
- angle = CFrame.Angles(-math.rad(70),0,0)
- coroutine.resume(coroutine.create(function()
- while not button_up do
- pos.position = pos.position + (mouse.Hit.p - torso.Position).unit * (10*char.Head.Size.Y)
- wait()
- end
- end))
- end)
- touchend = UserInputService.TouchEnded:connect(function()
- button_up = true
- angle = CFrame.new()
- end)
- mouse.Button1Down:connect(function()
- local button_up = false
- angle = CFrame.Angles(-math.rad(70),0,0)
- coroutine.resume(coroutine.create(function()
- while not button_up do
- pos.position = pos.position + (mouse.Hit.p - torso.Position).unit * (10*char.Head.Size.Y)
- wait()
- end
- end))
- mouse.Button1Up:wait()
- button_up = true
- angle = CFrame.new()
- end)
- while selected do
- gyro.cframe = CFrame.new(torso.Position, mouse.Hit.p) * angle
- wait()
- end
- end)
- bin.Deselected:connect(function()
- selected = false
- touchstart:disconnect()
- touchend:Disconnect()
- pos:Destroy()
- gyro:Destroy()
- end)]],owner.Backpack)
Add Comment
Please, Sign In to add comment