Advertisement
fireband12

Untitled

Jul 16th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.20 KB | None | 0 0
  1. repeat wait() until game:getService("Players").LocalPlayer.Character ~= nil;
  2.  
  3. local Services = setmetatable({}, { __index = function(Self, Request) return game:getService(Request) or nil end })
  4. local Player = Services.Players.LocalPlayer
  5. local Mouse = Player:GetMouse()
  6. local Backpack = Player.Backpack
  7. local Character = Player.Character
  8. local PlayerGui = Player.PlayerGui
  9. local Camera = Workspace.CurrentCamera
  10. local RunService = Services.RunService
  11. local Head = Character:findFirstChild("Head")
  12. local Torso = Character:findFirstChild("Torso")
  13. local RootPart = Character:findFirstChild("HumanoidRootPart")
  14. local RightArm = Character:findFirstChild("Right Arm")
  15. local LeftArm = Character:findFirstChild("Left Arm")
  16. local RightLeg = Character:findFirstChild("Right Leg")
  17. local LeftLeg = Character:findFirstChild("Left Leg")
  18. local Humanoid = Character:findFirstChild("Humanoid")
  19. local Neck = Torso:findFirstChild("Neck")
  20. local RootJoint = RootPart:findFirstChild("RootJoint")
  21. local RightSH = Torso:findFirstChild("Right Shoulder")
  22. local LeftSH = Torso:findFirstChild("Left Shoulder")
  23. local RightHip = Torso:findFirstChild("Right Hip")
  24. local LeftHip = Torso:findFirstChild("Left Hip")
  25. local it = Instance.new
  26. local vt = Vector3.new
  27. local bc = BrickColor.new
  28. local c3 = Color3.new
  29. local UD2 = UDim2.new
  30. local cf = CFrame.new
  31. local euler = CFrame.fromEulerAnglesXYZ
  32. local angles = CFrame.Angles
  33. local bc = BrickColor.new
  34. local c3 = Color3.new
  35. local deg = math.deg
  36. local inf = math.huge
  37. local rad = math.rad
  38. local pi = math.pi
  39. local random = math.random
  40. local IsEquipping = false
  41. local IsEquipped = false
  42. local IsArresting = false
  43. local IsUnArresting = false
  44. local KeyDown = {}
  45. local KeyLastDown = {}
  46. local cuffed = {}
  47.  
  48. function check(p)
  49. for i,v in pairs(cuffed) do
  50. if p:lower() == v:lower() then
  51. return true
  52. end
  53. end
  54. end
  55.  
  56. Lerp = function(a,b,c)
  57. return a+(b-a)*c
  58. end
  59.  
  60. function ctlerp(c1,c2,al)
  61. local com1 = {c1:components()}
  62. local com2 = {c2:components()}
  63. for i,v in pairs(com1) do
  64. com1[i] = lerp(v,com2[i],al)
  65. end
  66. return CFrame.new(unpack(com1))
  67. end
  68.  
  69. do
  70. local function QuaternionFromCFrame(cf)
  71. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  72. local trace = m00 + m11 + m22
  73. if trace > 0 then
  74. local s = math.sqrt(1 + trace)
  75. local recip = 0.5/s
  76. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  77. else
  78. local i = 0
  79. if m11 > m00 then
  80. i = 1
  81. end
  82. if m22 > (i == 0 and m00 or m11) then
  83. i = 2
  84. end
  85. if i == 0 then
  86. local s = math.sqrt(m00-m11-m22+1)
  87. local recip = 0.5/s
  88. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  89. elseif i == 1 then
  90. local s = math.sqrt(m11-m22-m00+1)
  91. local recip = 0.5/s
  92. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  93. elseif i == 2 then
  94. local s = math.sqrt(m22-m00-m11+1)
  95. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  96. end
  97. end
  98. end
  99. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  100. local xs, ys, zs = x + x, y + y, z + z
  101. local wx, wy, wz = w*xs, w*ys, w*zs
  102. local xx = x*xs
  103. local xy = x*ys
  104. local xz = x*zs
  105. local yy = y*ys
  106. local yz = y*zs
  107. local zz = z*zs
  108. 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))
  109. end
  110. local function QuaternionSlerp(a, b, t)
  111. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  112. local startInterp, finishInterp;
  113. if cosTheta >= 0.0001 then
  114. if (1 - cosTheta) > 0.0001 then
  115. local theta = math.acos(cosTheta)
  116. local invSinTheta = 1/math.sin(theta)
  117. startInterp = math.sin((1-t)*theta)*invSinTheta
  118. finishInterp = math.sin(t*theta)*invSinTheta
  119. else
  120. startInterp = 1-t
  121. finishInterp = t
  122. end
  123. else
  124. if (1+cosTheta) > 0.0001 then
  125. local theta = math.acos(-cosTheta)
  126. local invSinTheta = 1/math.sin(theta)
  127. startInterp = math.sin((t-1)*theta)*invSinTheta
  128. finishInterp = math.sin(t*theta)*invSinTheta
  129. else
  130. startInterp = t-1
  131. finishInterp = t
  132. end
  133. end
  134. 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
  135. end
  136. function clerp(a,b,t)
  137. local qa = {QuaternionFromCFrame(a)}
  138. local qb = {QuaternionFromCFrame(b)}
  139. local ax, ay, az = a.x, a.y, a.z
  140. local bx, by, bz = b.x, b.y, b.z
  141. local _t = 1-t
  142. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  143. end
  144.  
  145. end
  146.  
  147.  
  148. local Tool = it("HopperBin", Backpack)
  149. Tool.Name = "Handcuffs"
  150.  
  151.  
  152. function newPart(Parent, FormFactor, Transparency, Size, BottomSurface, TopSurface,CanCollide)
  153. local newP = it("Part")
  154. newP.Parent = Parent
  155. newP.Transparency = Transparency
  156. newP.Size = Size
  157. newP.FormFactor = "Custom"
  158. newP.TopSurface = TopSurface
  159. newP.BottomSurface = BottomSurface
  160. newP.CanCollide = CanCollide
  161. return newP
  162. end
  163.  
  164. function Arrest(hit)
  165. IsArresting = true
  166. local Tool = RightArm:WaitForChild("Cuff")
  167. pcall(function()
  168. if hit ~= nil and hit.Parent.Humanoid ~= nil and hit.Parent.Humanoid.Parent ~= Player and hit.Parent.Humanoid ~= "Hat" then
  169. local C = RightArm:WaitForChild("Cuff")
  170. local Target = hit.Parent
  171. local p = game.Players:GetPlayerFromCharacter(Target)
  172. local T2 = Target:FindFirstChild("Torso")
  173. local Right = Target:FindFirstChild("Right Arm")
  174. local Left = Target:FindFirstChild("Left Arm")
  175. local RightS = Target.Torso:FindFirstChild("Right Shoulder")
  176. local LeftS = Target.Torso:FindFirstChild("Left Shoulder")
  177. RightS.Part0 = nil
  178. LeftS.Part0 = nil
  179. local r = it("Snap", T2 )
  180. r.Name = "RSnap"
  181. r.Part0 = T2
  182. r.Part1 = Right
  183. r.C1 = CFrame.new(-0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(45))
  184. local l = it("Snap", T2)
  185. l.Name = "LSnap"
  186. l.Part0 = T2
  187. l.Part1 = Left
  188. l.C1 = CFrame.new(0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(-45))
  189. local h = it("Snap", T2)
  190. h.Name = "Holder"
  191. h.Part0 = T2
  192. h.Part1 = Torso
  193. h.C0 = CFrame.new(0,0,3)
  194. C:Destroy()
  195. coroutine.resume(coroutine.create(function()
  196. for i,v in pairs(cuffed) do
  197. table.insert(cuffed, p.Name)
  198. end
  199. end))
  200. coroutine.resume(coroutine.create(function()
  201. for i,v in pairs(p.Backpack:GetChildren()) do
  202. v:Destroy()
  203. end
  204. end))
  205. else
  206. if hit.Parent.Torso:FindFirstChild("RSnap") then
  207. print("Already Cuffed")
  208. end
  209. end
  210. end)
  211. end
  212.  
  213.  
  214. IsArresting = false
  215.  
  216. function unArrest(hit)
  217. if IsArresting == false then
  218. IsUnArresting = true
  219. local Tool = RightArm:WaitForChild("Cuff")
  220. if hit ~= nil and hit.Parent.Humanoid ~= nil and hit.Parent.Humanoid.Parent ~= Player then
  221. local Target = hit.Parent
  222. local p = game.Players:GetPlayerFromCharacter(Target)
  223. local T2 = Target:FindFirstChild("Torso")
  224. local Right = Target:FindFirstChild("Right Arm")
  225. local Left = Target:FindFirstChild("Left Arm")
  226. local RightS = Target.Torso:FindFirstChild("Right Shoulder")
  227. local LeftS = Target.Torso:FindFirstChild("Left Shoulder")
  228. if Right:FindFirstChild("RSnap") and Left:FindFirstChild("LSnap") then
  229. local Joint1 = Right:FindFirstChild("RSnap")
  230. local Joint2 = Left:FindFirstChild("LSnap")
  231. Joint1.C0 = clerp(Joint1.C0,cf(1.5,0.5,0)*euler(0, 0, 0),.4)
  232. Joint1.C1 = cf(0, 0.5, 0)
  233. Joint2.C0 = clerp(Joint2.C0,cf(-1.5,0.5,0)*euler(0,0,0),.4)
  234. Joint2.C1 = cf(0, 0.5, 0)
  235. end
  236. end
  237. end
  238. end
  239.  
  240. function keyDown(Current_Key)
  241. local time = tick()
  242. local lasttime = tick()-(KeyLastDown[Current_Key] or 0)
  243. KeyDown[Current_Key] = true
  244. KeyLastDown[Current_Key] = time
  245.  
  246. if Current_Key == "f" and IsArresting == false and IsEquipping == false and IsEquipped == true then
  247. Kick()
  248. end
  249. end
  250.  
  251.  
  252.  
  253. function Selected()
  254. IsEquipping = true
  255. RightSH.Part0 = nil
  256. local w = it("Snap", Torso)
  257. w.Part0 = RightArm
  258. w.Part1 = Torso
  259. w.Name = "Joint1"
  260. for i = 0 , 1 , 0.1 do
  261. w.C0 = clerp(w.C0,cf(-2.15,0.64,0.64)*CFrame.Angles(math.rad(-130),0,0),.1)
  262. end
  263. local t = newPart(RightArm, "Custom", 0 , Vector3.new(.05,.05,.03), "Smooth", "Smooth", false)
  264. t.Name = "Cuff"
  265. local s = it("Snap", RightArm)
  266. s.Part0 = t
  267. s.Part1 = RightArm
  268. s.Name = "PartW"
  269. s.C0 = CFrame.new(0,1,0)
  270. t.Touched:connect(function(hit) Arrest(hit) end)
  271. end
  272.  
  273. IsEquipping = false
  274. IsEquipped = true
  275.  
  276.  
  277. function UnSelected()
  278. IsEquipping = true
  279. RightSH.Part0 = Torso
  280. local Joint1 = Torso:WaitForChild("Joint1")
  281. for i = 0 , 1 , 0.1 do
  282. wait()
  283. Joint1.C0 = clerp(Joint1.C0,cf(-1.5,0.5,0)*euler(0, 0, 0),.4)
  284. Joint1.C1 = cf(0, 0.5, 0)
  285. end
  286. IsEquipping = false
  287. IsEquipped = false
  288. for i,v in pairs(Torso:GetChildren()) do
  289. if v:IsA("Snap") and v.Name == "Joint1" then
  290. v:Destroy()
  291. end
  292. end
  293. for i,v in pairs(RightArm:GetChildren()) do
  294. if v.Name == "Cuff" or v.Name == "PartW" then
  295. v:Destroy()
  296. end
  297. end
  298. end
  299.  
  300.  
  301.  
  302.  
  303. Tool.Selected:connect(function() Selected() end)
  304. Tool.Deselected:connect(function() UnSelected() end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement