Advertisement
Thefrozen106

Leash Script

Jun 9th, 2017
1,808
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.30 KB | None | 1 0
  1. --Cool o.O
  2.  
  3. --[[
  4. // Created by Peyton
  5. // Idk why I made this. I was bored and its pretty funny to watch people react.
  6. // And this thing is not as glitchy as it used to be.
  7. // Sorry the UI looks so bad. I'll fix it sometime.
  8. --]]
  9.  
  10. local LeaveCollar = true -- Leaves the collar on the people you capture after releasing them.
  11. -- I will add more functionality for this in the UI later.
  12.  
  13. -- Thats all the settings for now. --
  14.  
  15.  
  16. -- Don't touch anything below for the best experience. -- (plus im a sloppy c0der xd) --
  17.  
  18. local Captured = false
  19.  
  20. function leash(plr)
  21. if Captured then
  22. Release()
  23. end
  24. Char = game.Players[plr].Character
  25. Master = game.Players.LocalPlayer.Character
  26.  
  27. Neck = Instance.new("Part")
  28.  
  29. Pole = Instance.new("Part")
  30. Pole.Name = "Pole"
  31. Pole.Size = Vector3.new(0.1,0.1,0.1)
  32. Pole.Transparency = 1
  33.  
  34. Weld4 = Instance.new("Weld")
  35. Weld4.Parent = Pole
  36. Weld4.Part0 = Pole
  37. Weld4.Part1 = Master["Left Arm"]
  38. Weld4.C0 = CFrame.new(0,0.5,0)
  39.  
  40. Pole.Parent = Master["Left Arm"]
  41.  
  42. Attachment = Instance.new("Attachment", Neck)
  43. Attachment1 = Instance.new("Attachment", Pole)
  44.  
  45. Neck.Size = Vector3.new(0.1,0.1,0.1)
  46. Neck.CanCollide = false
  47. Neck.Transparency = 1
  48.  
  49. Weld3 = Instance.new("Weld")
  50. Weld3.Parent = Neck
  51. Weld3.Part0 = Neck
  52. Weld3.Part1 = Char.Head
  53. Weld3.C0 = CFrame.new(0,0.5,0.55)
  54.  
  55. Instance.new("BodyGyro", Char.Torso)
  56. Instance.new("BodyGyro", Master.Torso)
  57. Neck.Parent = Char.Head
  58.  
  59. Collar = Instance.new("Part")
  60. Collar.Size = Vector3.new(1,0.2,1)
  61. Collar.CanCollide = false
  62. Collar.Transparency = 0
  63. Collar.BrickColor = BrickColor.Black()
  64.  
  65. local CollarMesh = Instance.new("CylinderMesh", Collar)
  66. CollarMesh.Scale = Vector3.new(1.2,0.8,1.2)
  67.  
  68. local Weld6 = Instance.new("Weld")
  69. Weld6.Parent = Collar
  70. Weld6.Part0 = Collar
  71. Weld6.Part1 = Char.Head
  72. Weld6.C0 = CFrame.new(0,0.5,0)
  73.  
  74. Collar.Parent = Char.Head
  75.  
  76. Leash = Instance.new("RopeConstraint", Master["Left Arm"])
  77. Leash.Color = BrickColor.Black()
  78. Leash.Thickness = 0.1
  79. Leash.Visible = true
  80. Leash.Restitution = 1
  81. Leash.Length = 5
  82.  
  83. Leash.Attachment0 = Attachment
  84. Leash.Attachment1 = Master["Left Arm"].Pole.Attachment
  85.  
  86. Char.Humanoid.WalkSpeed = 0
  87. Char.Humanoid.PlatformStand = true
  88. Char.Humanoid.Sit = true
  89. Clone = Char.HumanoidRootPart:Clone()
  90. Char.HumanoidRootPart:Destroy()
  91.  
  92. Char.Humanoid.Died:connect(function()
  93. Release()
  94. end)
  95.  
  96. Master.Humanoid.Died:connect(function()
  97. Release()
  98. end)
  99. end
  100.  
  101. local selecteduser = nil
  102.  
  103. local NewGuiPart1 = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
  104.  
  105. local NewGuiPart2 = Instance.new("TextLabel")
  106. NewGuiPart2.Size = UDim2.new(0, 300, 0, 20)
  107. NewGuiPart2.Position = UDim2.new(0.5, -150, 0.4, -10)
  108. NewGuiPart2.Font = Enum.Font.Bodoni
  109. NewGuiPart2.FontSize = Enum.FontSize.Size14
  110. NewGuiPart2.Text = "Leash Gui"
  111. NewGuiPart2.TextScaled = true
  112. NewGuiPart2.TextWrapped = true
  113. NewGuiPart2.Draggable = true
  114. NewGuiPart2.Active = true
  115. NewGuiPart2.Parent = NewGuiPart1
  116.  
  117. local NewGuiPart3 = Instance.new("Frame")
  118. NewGuiPart3.Name = "Main"
  119. NewGuiPart3.Position = UDim2.new(0, 0, 1, 0)
  120. NewGuiPart3.Size = UDim2.new(1, 0, 0, 150)
  121. NewGuiPart3.Parent = NewGuiPart2
  122.  
  123. local NewGuiPart4 = Instance.new("TextButton")
  124. NewGuiPart4.Active = true
  125. NewGuiPart4.Name = "LeashEm"
  126. NewGuiPart4.Position = UDim2.new(0, 0, 1, -30)
  127. NewGuiPart4.Selectable = true
  128. NewGuiPart4.Size = UDim2.new(1, 0, 0, 30)
  129. NewGuiPart4.Style = Enum.ButtonStyle.Custom
  130. NewGuiPart4.Font = Enum.Font.Antique
  131. NewGuiPart4.FontSize = Enum.FontSize.Size14
  132. NewGuiPart4.Text = "Leash Em"
  133. NewGuiPart4.TextScaled = true
  134. NewGuiPart4.TextWrapped = true
  135. NewGuiPart4.Parent = NewGuiPart3
  136.  
  137. local NewGuiPart5 = Instance.new("ScrollingFrame")
  138. NewGuiPart5.Name = "Players"
  139. NewGuiPart5.Selectable = true
  140. NewGuiPart5.Size = UDim2.new(1, 0, 0, 100)
  141. NewGuiPart5.ClipsDescendants = true
  142. NewGuiPart5.Parent = NewGuiPart3
  143.  
  144. local ListUI = Instance.new("UIListLayout", NewGuiPart5)
  145.  
  146. local Selected = Instance.new("TextLabel", NewGuiPart4)
  147. Selected.Position = UDim2.new(0,0,0,-20)
  148. Selected.Size = UDim2.new(1,0,0,20)
  149. Selected.Text = "Selected: nil"
  150.  
  151. NewGuiPart4.MouseButton1Down:connect(function()
  152. if Captured then
  153. Release()
  154. else
  155. if selecteduser ~= nil then
  156. if game.Players:FindFirstChild(selecteduser) then
  157. leash(selecteduser)
  158. wait()
  159. Capture()
  160. end
  161. end
  162. end
  163. end)
  164.  
  165. function Capture()
  166. NewGuiPart4.Text = "Release"
  167. Captured = true
  168. NewGuiPart5.Visible = false
  169. NewGuiPart4.Position = UDim2.new(0, 0, 0, 20)
  170. NewGuiPart4.Size = UDim2.new(1, 0, 0, 130)
  171. TP()
  172. end
  173.  
  174. function TP()
  175. local prt = Instance.new("Part", game.Players.LocalPlayer.Character)
  176. prt.Transparency = 1
  177. prt.CanCollide = false
  178. prt.Anchored = true
  179. prt.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame * CFrame.new(Vector3.new(0, 5, -5))
  180. Char.Torso.CFrame = prt.CFrame * CFrame.new(0, 0, -4) * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(180), math.rad(0))
  181. prt:Destroy()
  182. end
  183.  
  184. function Release()
  185. Neck:Destroy()
  186. Pole:Destroy()
  187. Weld4:Destroy()
  188. Attachment:Destroy()
  189. Attachment1:Destroy()
  190. Weld3:Destroy()
  191. Char.Torso.BodyGyro:Destroy()
  192. Master.Torso.BodyGyro:Destroy()
  193. Leash:Destroy()
  194. Clone.Parent = Char
  195. Char.Humanoid.WalkSpeed = 16
  196. Char.Humanoid.PlatformStand = false
  197. Char.Humanoid.Sit = false
  198. if not LeaveCollar then
  199. Collar:Destroy()
  200. end
  201. NewGuiPart4.Text = "Leash Em"
  202. NewGuiPart4.Position = UDim2.new(0, 0, 1, -30)
  203. NewGuiPart4.Size = UDim2.new(1, 0, 0, 30)
  204. NewGuiPart5.Visible = true
  205. Captured = false
  206. wait()
  207. TP()
  208. end
  209.  
  210. function playerbuttons(name)
  211. local button = Instance.new("TextButton", NewGuiPart5)
  212. button.Size = UDim2.new(1, 0, 0, 25)
  213. button.TextScaled = true
  214. button.Text = name
  215. button.Name = name
  216. button.MouseButton1Down:connect(function()
  217. Selected.Text = "Selected: "..name
  218. selecteduser = name
  219. end)
  220. NewGuiPart5.CanvasSize = UDim2.new(0,0,0, NewGuiPart5.CanvasSize.Y.Offset + 25)
  221. end
  222.  
  223. game.Players.ChildAdded:connect(function(thing)
  224. UpdateList()
  225. end)
  226.  
  227. game.Players.ChildRemoved:connect(function(thing)
  228. UpdateList()
  229. end)
  230.  
  231. function UpdateList()
  232. NewGuiPart5.CanvasSize = UDim2.new(0,0,0,0)
  233. for i,v in pairs(NewGuiPart5:GetChildren()) do
  234. if v.ClassName == "TextButton" then
  235. v:Destroy()
  236. end
  237. end
  238.  
  239. for i,v in pairs(game.Players:GetChildren()) do
  240. if v.Name ~= game.Players.LocalPlayer.Name then
  241. playerbuttons(v.Name)
  242. end
  243. end
  244. end
  245.  
  246. UpdateList()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement