Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- repeat wait() until game:getService("Players").LocalPlayer.Character ~= nil;
- local Services = setmetatable({}, { __index = function(Self, Request) return game:getService(Request) or nil end })
- local Player = Services.Players.LocalPlayer
- local Mouse = Player:GetMouse()
- local Backpack = Player.Backpack
- local Character = Player.Character
- local PlayerGui = Player.PlayerGui
- local Camera = Workspace.CurrentCamera
- local RunService = Services.RunService
- local Head = Character:findFirstChild("Head")
- local Torso = Character:findFirstChild("Torso")
- local RootPart = Character:findFirstChild("HumanoidRootPart")
- local RightArm = Character:findFirstChild("Right Arm")
- local LeftArm = Character:findFirstChild("Left Arm")
- local RightLeg = Character:findFirstChild("Right Leg")
- local LeftLeg = Character:findFirstChild("Left Leg")
- local Humanoid = Character:findFirstChild("Humanoid")
- local Neck = Torso:findFirstChild("Neck")
- local RootJoint = RootPart:findFirstChild("RootJoint")
- local RightSH = Torso:findFirstChild("Right Shoulder")
- local LeftSH = Torso:findFirstChild("Left Shoulder")
- local RightHip = Torso:findFirstChild("Right Hip")
- local LeftHip = Torso:findFirstChild("Left Hip")
- local it = Instance.new
- local vt = Vector3.new
- local bc = BrickColor.new
- local c3 = Color3.new
- local UD2 = UDim2.new
- local cf = CFrame.new
- local euler = CFrame.fromEulerAnglesXYZ
- local angles = CFrame.Angles
- local bc = BrickColor.new
- local c3 = Color3.new
- local deg = math.deg
- local inf = math.huge
- local rad = math.rad
- local pi = math.pi
- local random = math.random
- local IsEquipping = false
- local IsEquipped = false
- local IsArresting = false
- local IsUnArresting = false
- local KeyDown = {}
- local KeyLastDown = {}
- local cuffed = {}
- function check(p)
- for i,v in pairs(cuffed) do
- if p:lower() == v:lower() then
- return true
- end
- end
- end
- Lerp = function(a,b,c)
- return a+(b-a)*c
- end
- function ctlerp(c1,c2,al)
- local com1 = {c1:components()}
- local com2 = {c2:components()}
- for i,v in pairs(com1) do
- com1[i] = lerp(v,com2[i],al)
- end
- return CFrame.new(unpack(com1))
- end
- do
- local function QuaternionFromCFrame(cf)
- local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
- local trace = m00 + m11 + m22
- if trace > 0 then
- local s = math.sqrt(1 + trace)
- local recip = 0.5/s
- return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
- else
- local i = 0
- if m11 > m00 then
- i = 1
- end
- if m22 > (i == 0 and m00 or m11) then
- i = 2
- end
- if i == 0 then
- local s = math.sqrt(m00-m11-m22+1)
- local recip = 0.5/s
- return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
- elseif i == 1 then
- local s = math.sqrt(m11-m22-m00+1)
- local recip = 0.5/s
- return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
- elseif i == 2 then
- local s = math.sqrt(m22-m00-m11+1)
- local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
- end
- end
- end
- local function QuaternionToCFrame(px, py, pz, x, y, z, w)
- local xs, ys, zs = x + x, y + y, z + z
- local wx, wy, wz = w*xs, w*ys, w*zs
- local xx = x*xs
- local xy = x*ys
- local xz = x*zs
- local yy = y*ys
- local yz = y*zs
- local zz = z*zs
- return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
- end
- local function QuaternionSlerp(a, b, t)
- local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
- local startInterp, finishInterp;
- if cosTheta >= 0.0001 then
- if (1 - cosTheta) > 0.0001 then
- local theta = math.acos(cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((1-t)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = 1-t
- finishInterp = t
- end
- else
- if (1+cosTheta) > 0.0001 then
- local theta = math.acos(-cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((t-1)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = t-1
- finishInterp = t
- end
- end
- return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
- end
- function clerp(a,b,t)
- local qa = {QuaternionFromCFrame(a)}
- local qb = {QuaternionFromCFrame(b)}
- local ax, ay, az = a.x, a.y, a.z
- local bx, by, bz = b.x, b.y, b.z
- local _t = 1-t
- return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
- end
- end
- local Tool = it("HopperBin", Backpack)
- Tool.Name = "Handcuffs"
- function newPart(Parent, FormFactor, Transparency, Size, BottomSurface, TopSurface,CanCollide)
- local newP = it("Part")
- newP.Parent = Parent
- newP.Transparency = Transparency
- newP.Size = Size
- newP.FormFactor = "Custom"
- newP.TopSurface = TopSurface
- newP.BottomSurface = BottomSurface
- newP.CanCollide = CanCollide
- return newP
- end
- function Arrest(hit)
- IsArresting = true
- local Tool = RightArm:WaitForChild("Cuff")
- pcall(function()
- if hit ~= nil and hit.Parent.Humanoid ~= nil and hit.Parent.Humanoid.Parent ~= Player and hit.Parent.Humanoid ~= "Hat" then
- local C = RightArm:WaitForChild("Cuff")
- local Target = hit.Parent
- local p = game.Players:GetPlayerFromCharacter(Target)
- local T2 = Target:FindFirstChild("Torso")
- local Right = Target:FindFirstChild("Right Arm")
- local Left = Target:FindFirstChild("Left Arm")
- local RightS = Target.Torso:FindFirstChild("Right Shoulder")
- local LeftS = Target.Torso:FindFirstChild("Left Shoulder")
- RightS.Part0 = nil
- LeftS.Part0 = nil
- local r = it("Snap", T2 )
- r.Name = "RSnap"
- r.Part0 = T2
- r.Part1 = Right
- r.C1 = CFrame.new(-0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(45))
- local l = it("Snap", T2)
- l.Name = "LSnap"
- l.Part0 = T2
- l.Part1 = Left
- l.C1 = CFrame.new(0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(-45))
- local h = it("Snap", T2)
- h.Name = "Holder"
- h.Part0 = T2
- h.Part1 = Torso
- h.C0 = CFrame.new(0,0,3)
- C:Destroy()
- coroutine.resume(coroutine.create(function()
- for i,v in pairs(cuffed) do
- table.insert(cuffed, p.Name)
- end
- end))
- coroutine.resume(coroutine.create(function()
- for i,v in pairs(p.Backpack:GetChildren()) do
- v:Destroy()
- end
- end))
- else
- if hit.Parent.Torso:FindFirstChild("RSnap") then
- print("Already Cuffed")
- end
- end
- end)
- end
- IsArresting = false
- function unArrest(hit)
- if IsArresting == false then
- IsUnArresting = true
- local Tool = RightArm:WaitForChild("Cuff")
- if hit ~= nil and hit.Parent.Humanoid ~= nil and hit.Parent.Humanoid.Parent ~= Player then
- local Target = hit.Parent
- local p = game.Players:GetPlayerFromCharacter(Target)
- local T2 = Target:FindFirstChild("Torso")
- local Right = Target:FindFirstChild("Right Arm")
- local Left = Target:FindFirstChild("Left Arm")
- local RightS = Target.Torso:FindFirstChild("Right Shoulder")
- local LeftS = Target.Torso:FindFirstChild("Left Shoulder")
- if Right:FindFirstChild("RSnap") and Left:FindFirstChild("LSnap") then
- local Joint1 = Right:FindFirstChild("RSnap")
- local Joint2 = Left:FindFirstChild("LSnap")
- Joint1.C0 = clerp(Joint1.C0,cf(1.5,0.5,0)*euler(0, 0, 0),.4)
- Joint1.C1 = cf(0, 0.5, 0)
- Joint2.C0 = clerp(Joint2.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
- Joint2.C1 = cf(0, 0.5, 0)
- end
- end
- end
- end
- function keyDown(Current_Key)
- local time = tick()
- local lasttime = tick()-(KeyLastDown[Current_Key] or 0)
- KeyDown[Current_Key] = true
- KeyLastDown[Current_Key] = time
- if Current_Key == "f" and IsArresting == false and IsEquipping == false and IsEquipped == true then
- Kick()
- end
- end
- function Selected()
- IsEquipping = true
- RightSH.Part0 = nil
- local w = it("Snap", Torso)
- w.Part0 = RightArm
- w.Part1 = Torso
- w.Name = "Joint1"
- for i = 0 , 1 , 0.1 do
- w.C0 = clerp(w.C0,cf(-2.15,0.64,0.64)*CFrame.Angles(math.rad(-130),0,0),.1)
- end
- local t = newPart(RightArm, "Custom", 0 , Vector3.new(.05,.05,.03), "Smooth", "Smooth", false)
- t.Name = "Cuff"
- local s = it("Snap", RightArm)
- s.Part0 = t
- s.Part1 = RightArm
- s.Name = "PartW"
- s.C0 = CFrame.new(0,1,0)
- t.Touched:connect(function(hit) Arrest(hit) end)
- end
- IsEquipping = false
- IsEquipped = true
- function UnSelected()
- IsEquipping = true
- RightSH.Part0 = Torso
- local Joint1 = Torso:WaitForChild("Joint1")
- for i = 0 , 1 , 0.1 do
- wait()
- Joint1.C0 = clerp(Joint1.C0,cf(-1.5,0.5,0)*euler(0, 0, 0),.4)
- Joint1.C1 = cf(0, 0.5, 0)
- end
- IsEquipping = false
- IsEquipped = false
- for i,v in pairs(Torso:GetChildren()) do
- if v:IsA("Snap") and v.Name == "Joint1" then
- v:Destroy()
- end
- end
- for i,v in pairs(RightArm:GetChildren()) do
- if v.Name == "Cuff" or v.Name == "PartW" then
- v:Destroy()
- end
- end
- end
- Tool.Selected:connect(function() Selected() end)
- Tool.Deselected:connect(function() UnSelected() end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement