Advertisement
Hitman_Hell

Leash Script

Jun 21st, 2017
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.00 KB | None | 0 0
  1. -- READ THE SETTINGS BELOW --
  2.  
  3. local KeepWhenDie = false -- Keep the gui when you die and respawn.
  4. local LockFirstPerson = false -- Locks the victim(s)'s camera to first person while captured.
  5. local LeaveCollar = true -- Leaves the collar on the people you capture after releasing them.
  6. local RealisticMode = true
  7.  
  8. -- ^ With this enabled, you have to put the collar on the person (click them). Then they will show in the list.
  9. -- ^ Click them again while not leashed to take it off.
  10.  
  11.  
  12. --[[
  13.     //Made by Roblotic_Roblox
  14.    
  15.               [Updates]
  16.     //  Teleport players is fixed.
  17.     //  Updated gui.
  18.     //  New mode.
  19.     //  Fixed list loading.
  20.     //  Added a thing that keeps you from losing the gui when you die.
  21. --]]
  22.  
  23.  
  24. -- Don't touch anything below for the best experience. -- (plus im a sloppy c0der xd) --
  25.  
  26. local Captured = false
  27.  
  28. local Players = {}
  29.  
  30. local Leashed = {}
  31.  
  32. function leash(plr)
  33. if Captured then
  34.     Release(plr)
  35. end
  36. local Char = game.Players[plr].Character
  37. Master = game.Players.LocalPlayer.Character
  38.  
  39.  
  40. local Neck = Instance.new("Part")
  41.  
  42. local Pole = Instance.new("Part")
  43. Pole.Name = plr.."Pole"
  44. Pole.Size = Vector3.new(0.1,0.1,0.1)
  45. Pole.Transparency = 1
  46.  
  47. local Weld4 = Instance.new("Weld")
  48. Weld4.Parent = Pole
  49. Weld4.Part0 = Pole
  50. Weld4.Part1 = Master["Left Arm"]
  51. Weld4.C0 = CFrame.new(0,0.9,0)
  52.  
  53. Pole.Parent = Master["Left Arm"]
  54.  
  55. local Attachment = Instance.new("Attachment", Neck)
  56. Attachment.Name = plr.."Attachment"
  57. local Attachment1 = Instance.new("Attachment", Pole)
  58. Attachment1.Name = plr.."Attachment1"
  59.  
  60. Neck.Size = Vector3.new(0.1,0.1,0.1)
  61. Neck.CanCollide = false
  62. Neck.Transparency = 1
  63. Neck.Name = plr.."Neck"
  64.  
  65. local Weld3 = Instance.new("Weld")
  66. Weld3.Parent = Neck
  67. Weld3.Part0 = Neck
  68. Weld3.Part1 = Char.Head
  69. Weld3.C0 = CFrame.new(0,0.5,0.55)
  70. Weld3.Name = plr.."Weld3"
  71. Neck.Parent = Char.Head
  72.  
  73. local BodyGyro1 = Instance.new("BodyGyro", Char.Torso)
  74. BodyGyro1.Name = plr.."BodyGyro1"
  75. local BodyGyro2 = Instance.new("BodyGyro", Master.Torso)
  76. BodyGyro2.Name = plr.."BodyGyro2"
  77.  
  78.  
  79. if not RealisticMode then
  80. local Collar = Instance.new("Part")
  81. Collar.Size = Vector3.new(1,0.2,1)
  82. Collar.CanCollide = false
  83. Collar.Transparency = 0
  84. Collar.Name = plr.."Collar"
  85. Collar.BrickColor = BrickColor.Black()
  86.  
  87. local CollarMesh = Instance.new("CylinderMesh", Collar)
  88. CollarMesh.Scale = Vector3.new(1.2,0.8,1.2)
  89.  
  90. local Weld6 = Instance.new("Weld")
  91. Weld6.Parent = Collar
  92. Weld6.Part0 = Collar
  93. Weld6.Part1 = Char.Head
  94. Weld6.C0 = CFrame.new(0,0.5,0)
  95.  
  96. Collar.Parent = Char.Head
  97. end
  98.  
  99. local Leash = Instance.new("RopeConstraint", Master["Left Arm"])
  100. Leash.Color = BrickColor.Black()
  101. Leash.Thickness = 0.1
  102. Leash.Visible = true
  103. Leash.Name = plr.."Leash"
  104. Leash.Restitution = 1
  105. Leash.Length = 5
  106.  
  107. Leash.Attachment0 = Attachment
  108. Leash.Attachment1 = Attachment1
  109.  
  110. Char.Humanoid.WalkSpeed = 0
  111. Char.Humanoid.PlatformStand = true
  112. Char.Humanoid.Sit = true
  113. local Clone = Char.HumanoidRootPart:Clone()
  114. Clone.Name = plr.."HumanoidRootPart"
  115. Clone.Parent = game.Players.LocalPlayer.PlayerScripts
  116. Char.HumanoidRootPart:Destroy()
  117.  
  118. Char.Humanoid.Died:connect(function()
  119.     Release(plr)
  120. end)
  121.  
  122. Master.Humanoid.Died:connect(function()
  123.     Release(plr)
  124. end)
  125. table.insert(Leashed, plr)
  126. end
  127.  
  128. local selecteduser = nil
  129.  
  130. local NewGuiPart1 = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
  131.  
  132. local NewGuiPart2 = Instance.new("TextLabel")
  133. NewGuiPart2.Size = UDim2.new(0, 300, 0, 20)
  134. NewGuiPart2.Position = UDim2.new(0.5, -150, 0.4, -10)
  135. NewGuiPart2.Font = Enum.Font.Bodoni
  136. NewGuiPart2.FontSize = Enum.FontSize.Size14
  137. NewGuiPart2.Text = "Leash Gui"
  138. NewGuiPart2.TextScaled = true
  139. NewGuiPart2.TextWrapped = true
  140. NewGuiPart2.Draggable = true
  141. NewGuiPart2.Active = true
  142. NewGuiPart2.Parent = NewGuiPart1
  143. NewGuiPart2.BackgroundTransparency = 0.6
  144. NewGuiPart2.BorderSizePixel = 0
  145. NewGuiPart2.TextColor3 = Color3.new(1,1,1)
  146.  
  147. local NewGuiPart3 = Instance.new("Frame")
  148. NewGuiPart3.Name = "Main"
  149. NewGuiPart3.Position = UDim2.new(0, 0, 1, 0)
  150. NewGuiPart3.Size = UDim2.new(1, 0, 0, 150)
  151. NewGuiPart3.Parent = NewGuiPart2
  152. NewGuiPart3.BackgroundTransparency = 0.6
  153. NewGuiPart3.BorderSizePixel = 0
  154.  
  155. local NewGuiPart4 = Instance.new("TextButton")
  156. NewGuiPart4.Active = true
  157. NewGuiPart4.Name = "LeashEm"
  158. NewGuiPart4.Position = UDim2.new(0, 0, 1, -30)
  159. NewGuiPart4.Selectable = true
  160. NewGuiPart4.Size = UDim2.new(1, 0, 0, 30)
  161. NewGuiPart4.Style = Enum.ButtonStyle.Custom
  162. NewGuiPart4.Font = Enum.Font.Antique
  163. NewGuiPart4.FontSize = Enum.FontSize.Size14
  164. NewGuiPart4.Text = "Leash Em"
  165. NewGuiPart4.TextScaled = true
  166. NewGuiPart4.TextWrapped = true
  167. NewGuiPart4.Parent = NewGuiPart3
  168. NewGuiPart4.BackgroundTransparency = 0.6
  169. NewGuiPart4.BorderSizePixel = 0
  170. NewGuiPart4.TextColor3 = Color3.new(1,1,1)
  171.  
  172. local NewGuiPart5 = Instance.new("ScrollingFrame")
  173. NewGuiPart5.Name = "Players"
  174. NewGuiPart5.Selectable = true
  175. NewGuiPart5.Size = UDim2.new(1, 0, 0, 100)
  176. NewGuiPart5.ClipsDescendants = true
  177. NewGuiPart5.Parent = NewGuiPart3
  178. NewGuiPart5.BackgroundTransparency = 0.6
  179. NewGuiPart5.BorderSizePixel = 0
  180.  
  181. local ListUI = Instance.new("UIListLayout", NewGuiPart5)
  182.  
  183. local Selected = Instance.new("TextLabel", NewGuiPart4)
  184. Selected.Position = UDim2.new(0,0,0,-20)
  185. Selected.Size = UDim2.new(1,0,0,20)
  186. Selected.Text = "Selected: nil"
  187. Selected.BackgroundTransparency = 0.6
  188. Selected.BorderSizePixel = 0
  189. Selected.TextColor3 = Color3.new(1,1,1)
  190.  
  191. NewGuiPart4.MouseButton1Down:connect(function()
  192.     local found = false
  193.     for i,v in pairs(Leashed) do
  194.         if selecteduser == v then
  195.             found = true
  196.         end
  197.     end
  198.     if found then
  199.         Release(selecteduser)
  200.     else
  201.         if selecteduser ~= nil then
  202.             if game.Players:FindFirstChild(selecteduser) then
  203.                 wait()
  204.                 Capture(selecteduser)
  205.             end
  206.         end
  207.     end
  208. end)
  209.  
  210. function Capture(user)
  211.     local char = user
  212.     if LockFirstPerson then
  213.         if game.Players:FindFirstChild(char) then
  214.             game.Players[char].CameraMode = "LockFirstPerson"
  215.         end
  216.     end
  217.     TP(char)
  218.     NewGuiPart4.Text = "Release"
  219.     NewGuiPart5[char].BackgroundColor3 = Color3.new(0.5,1,0.5)
  220.     wait()
  221.     leash(char)
  222. end
  223.  
  224. function TP(plr)
  225.     game.Players[plr].Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0,1,-4) * CFrame.Angles(0,math.rad(180),0)
  226. end
  227.  
  228. function Release(plr)
  229. local found = false
  230. local pos = 0
  231. for i,v in pairs(Leashed) do
  232.     if v == plr then
  233.         found = true
  234.         pos = i
  235.     end
  236. end
  237. if found then
  238. local player = game.Players[plr].Character
  239.     player.Head[plr.."Neck"]:Destroy()
  240.     Master["Left Arm"][plr.."Pole"]:Destroy()
  241.     game.Players[plr].Character.Torso[plr.."BodyGyro1"]:Destroy()
  242.     Master.Torso[plr.."BodyGyro2"]:Destroy()
  243.     Master["Left Arm"][plr.."Leash"]:Destroy()
  244.     local rootpart = game.Players.LocalPlayer.PlayerScripts[plr.."HumanoidRootPart"]
  245.     rootpart.Name = "HumanoidRootPart"
  246.     rootpart.Parent = player
  247.     player.Humanoid.WalkSpeed = 16
  248.     player.Humanoid.PlatformStand = false
  249.     player.Humanoid.Sit = false
  250.     if not LeaveCollar or not RealisticMode then   
  251.     player.Head[plr.."Collar"]:Destroy()
  252.     end
  253.     game.Players[plr].CameraMode = "Classic"
  254.     NewGuiPart4.Text = "Leash Em"
  255.     NewGuiPart5.Visible = true
  256.     NewGuiPart5[plr].BackgroundColor3 = Color3.new(1,0.5,0.5)
  257.     table.remove(Leashed, pos)
  258.     wait()
  259.     TP(selecteduser)
  260. end
  261. end
  262.  
  263. function playerbuttons(name)
  264.     local button = Instance.new("TextButton", NewGuiPart5)
  265.     button.Size = UDim2.new(1, 0, 0, 25)
  266.     button.BackgroundColor3 = Color3.new(1,0.5,0.5)
  267.     button.TextColor3 = Color3.new(0.9,0.9,0.9)
  268.     button.BorderSizePixel = 0
  269.     button.BackgroundTransparency = 0.7
  270.     button.TextScaled = true
  271.     button.Text = name
  272.     button.Name = name
  273.     button.MouseButton1Down:connect(function()
  274.         Selected.Text = "Selected: "..name
  275.         selecteduser = name
  276.         checkleashed(name)
  277.     end)
  278.     NewGuiPart5.CanvasSize = UDim2.new(0,0,0, NewGuiPart5.CanvasSize.Y.Offset + 25)
  279. end
  280.  
  281. function checkleashed(plr)
  282.     if NewGuiPart5:FindFirstChild(plr) then
  283.         local found = false
  284.         for i,v in pairs(Leashed) do
  285.             if v == plr then
  286.                 found = true
  287.             end
  288.         end
  289.         if found then
  290.             NewGuiPart4.Text = "Release"
  291.         else
  292.             NewGuiPart4.Text = "Leash em"
  293.         end
  294.     end
  295. end
  296.  
  297. if not RealisticMode then
  298. game.Players.ChildAdded:connect(function(thing)
  299.     UpdateList()
  300. end)
  301. end
  302.  
  303. game.Players.ChildRemoved:connect(function(thing)
  304.     UpdateList()
  305. end)
  306.  
  307.  
  308. local LocalPlayer = game.Players.LocalPlayer
  309. local Mouse = LocalPlayer:GetMouse()
  310.  
  311. if RealisticMode then
  312. Mouse.Button1Down:connect(function()
  313. local found = false
  314. local hit = Mouse.Target
  315. local AlreadyIn = false
  316.  
  317. for i,v in pairs(Leashed)do
  318.     if hit.Parent.Name == v then
  319.         found = true
  320.     end
  321. end
  322. if not found then
  323. if hit ~= nil then
  324.     if hit.Parent:FindFirstChildOfClass("Humanoid") then
  325.         if hit.Parent.Head:FindFirstChild("Collar") then
  326.             AlreadyIn = true
  327.         end
  328.         if not AlreadyIn then
  329.             local Collar = Instance.new("Part")
  330.             Collar.Size = Vector3.new(1,0.2,1)
  331.             Collar.CanCollide = false
  332.             Collar.Name = "Collar"
  333.             Collar.Transparency = 0
  334.             Collar.BrickColor = BrickColor.Black()
  335.  
  336.             local CollarMesh = Instance.new("CylinderMesh", Collar)
  337.             CollarMesh.Scale = Vector3.new(1.2,0.8,1.2)
  338.  
  339.             local Weld6 = Instance.new("Weld")
  340.             Weld6.Parent = Collar
  341.             Weld6.Part0 = Collar
  342.             Weld6.Part1 = hit.Parent:FindFirstChild("Head")
  343.             Weld6.C0 = CFrame.new(0,0.5,0)
  344.  
  345.             Collar.Parent = hit.Parent:FindFirstChild("Head")
  346.             print('Complete!')
  347.             table.insert(Players, hit.Parent.Name)
  348.             UpdateList()
  349.         else
  350.             local Collar = hit.Parent.Head:FindFirstChild("Collar")
  351.             Collar:Destroy()
  352.             for i,v in pairs(Players) do
  353.                 if v == hit.Parent.Name then
  354.                     table.remove(Players, i)
  355.                 end
  356.             end
  357.             UpdateList()
  358.         end
  359.     end
  360. end
  361. end
  362. end)
  363. end
  364.  
  365. function UpdateList()
  366.     NewGuiPart5.CanvasSize = UDim2.new(0,0,0,0)
  367.     for i,v in pairs(NewGuiPart5:GetChildren()) do
  368.         if v.ClassName == "TextButton" then
  369.             v:Destroy()
  370.         end
  371.     end
  372.     for i,v in pairs(Leashed) do
  373.         if not game.Players:FindFirstChild(v) then
  374.             Master["Left Arm"][v.."Pole"]:Destroy()
  375.             Master.Torso[v.."BodyGyro2"]:Destroy()
  376.             Master["Left Arm"][v.."Leash"]:Destroy()
  377.             game.Players.LocalPlayer.PlayerScripts[v.."HumanoidRootPart"]:Destroy()
  378.             table.remove(Leashed, i)
  379.         end
  380.         if NewGuiPart5:FindFirstChild(v) then
  381.             NewGuiPart5[v].BackgroundColor3 = Color3.new(0.5,1,0.5)
  382.         end
  383.     end
  384.     if RealisticMode then
  385.         for i,v in pairs(Players) do
  386.             if game.Players:FindFirstChild(v) then
  387.                 playerbuttons(v)
  388.             end
  389.         end
  390.     else   
  391.         for i,v in pairs(game.Players:GetChildren()) do
  392.             if v.Name ~= game.Players.LocalPlayer.Name then
  393.                 playerbuttons(v.Name)
  394.             end
  395.         end
  396.     end
  397.     for i,v in pairs(Leashed)do
  398.         if NewGuiPart5:FindFirstChild(v) then
  399.             NewGuiPart5[v].BackgroundColor3 = Color3.new(0.5,1,0.5)
  400.         end
  401.     end
  402.    
  403.    
  404. end
  405.  
  406. function diething()
  407.     game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
  408.         wait(4.9)
  409.         NewGuiPart1.Parent = game.Players.LocalPlayer.PlayerScripts
  410.         game.Players.LocalPlayer.CharacterAdded:connect(function(character)
  411.             NewGuiPart1.Parent = game.Players.LocalPlayer.PlayerGui
  412.             diething()
  413.             wait(0.1)
  414.         end)
  415.     end)
  416. end
  417.  
  418. UpdateList()
  419. if KeepWhenDie then
  420. wait(1)
  421. diething()
  422. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement