Advertisement
Baldeagle22

Leash

Sep 16th, 2018
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.02 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. -- https://pastebin.com/raw/a3LD7ayv --
  88. -- READ THE SETTINGS BELOW --
  89.  
  90. local KeepWhenDie = false -- Keep the gui when you die and respawn.
  91. local LockFirstPerson = false -- Locks the victim(s)'s camera to first person while captured.
  92. local LeaveCollar = false -- Leaves the collar on the people you capture after releasing them.
  93. local RealisticMode = false
  94.  
  95. -- ^ With this enabled, you have to put the collar on the person (click them). Then they will show in the list.
  96. -- ^ Click them again while not leashed to take it off.
  97.  
  98.  
  99. --[[
  100. // Created by Peyton. Discord = [] Peyton []#5640
  101. // Send me suggestions. Maybe I'll add your idea to it.
  102.  
  103. // Teleport players is fixed.
  104. // Updated gui.
  105. // New mode.
  106. // Fixed list loading.
  107. // Added a thing that keeps you from losing the gui when you die.
  108. --]]
  109.  
  110.  
  111. -- Don't touch anything below for the best experience. -- (plus im a sloppy c0der xd) --
  112.  
  113. local Captured = false
  114.  
  115. local Players = {}
  116.  
  117. local Leashed = {}
  118.  
  119. function leash(plr)
  120. if Captured then
  121. Release(plr)
  122. end
  123. local Char = game.Players[plr].Character
  124. Master = game.Players.LocalPlayer.Character
  125.  
  126.  
  127. local Neck = Instance.new("Part")
  128.  
  129. local Pole = Instance.new("Part")
  130. Pole.Name = plr.."Pole"
  131. Pole.Size = Vector3.new(0.1,0.1,0.1)
  132. Pole.Transparency = 1
  133.  
  134. local Weld4 = Instance.new("Weld")
  135. Weld4.Parent = Pole
  136. Weld4.Part0 = Pole
  137. Weld4.Part1 = Master["Left Arm"]
  138. Weld4.C0 = CFrame.new(0,0.9,0)
  139.  
  140. Pole.Parent = Master["Left Arm"]
  141.  
  142. local Attachment = Instance.new("Attachment", Neck)
  143. Attachment.Name = plr.."Attachment"
  144. local Attachment1 = Instance.new("Attachment", Pole)
  145. Attachment1.Name = plr.."Attachment1"
  146.  
  147. Neck.Size = Vector3.new(0.1,0.1,0.1)
  148. Neck.CanCollide = false
  149. Neck.Transparency = 1
  150. Neck.Name = plr.."Neck"
  151.  
  152. local Weld3 = Instance.new("Weld")
  153. Weld3.Parent = Neck
  154. Weld3.Part0 = Neck
  155. Weld3.Part1 = Char.Head
  156. Weld3.C0 = CFrame.new(0,0.5,0.55)
  157. Weld3.Name = plr.."Weld3"
  158. Neck.Parent = Char.Head
  159.  
  160. local BodyGyro1 = Instance.new("BodyGyro", Char.Torso)
  161. BodyGyro1.Name = plr.."BodyGyro1"
  162. local BodyGyro2 = Instance.new("BodyGyro", Master.Torso)
  163. BodyGyro2.Name = plr.."BodyGyro2"
  164.  
  165.  
  166. if not RealisticMode then
  167. local Collar = Instance.new("Part")
  168. Collar.Size = Vector3.new(1,0.2,1)
  169. Collar.CanCollide = false
  170. Collar.Transparency = 0
  171. Collar.Name = plr.."Collar"
  172. Collar.BrickColor = BrickColor.Black()
  173.  
  174. local CollarMesh = Instance.new("CylinderMesh", Collar)
  175. CollarMesh.Scale = Vector3.new(1.2,0.8,1.2)
  176.  
  177. local Weld6 = Instance.new("Weld")
  178. Weld6.Parent = Collar
  179. Weld6.Part0 = Collar
  180. Weld6.Part1 = Char.Head
  181. Weld6.C0 = CFrame.new(0,0.5,0)
  182.  
  183. Collar.Parent = Char.Head
  184. end
  185.  
  186. local Leash = Instance.new("RopeConstraint", Master["Left Arm"])
  187. Leash.Color = BrickColor.Black()
  188. Leash.Thickness = 0.1
  189. Leash.Visible = true
  190. Leash.Name = plr.."Leash"
  191. Leash.Restitution = 1
  192. Leash.Length = 5
  193.  
  194. Leash.Attachment0 = Attachment
  195. Leash.Attachment1 = Attachment1
  196.  
  197. Char.Humanoid.WalkSpeed = 0
  198. Char.Humanoid.PlatformStand = true
  199. Char.Humanoid.Sit = true
  200. local Clone = Char.HumanoidRootPart:Clone()
  201. Clone.Name = plr.."HumanoidRootPart"
  202. Clone.Parent = game.Players.LocalPlayer.PlayerScripts
  203. Char.HumanoidRootPart:Destroy()
  204.  
  205. Char.Humanoid.Died:connect(function()
  206. Release(plr)
  207. end)
  208.  
  209. Master.Humanoid.Died:connect(function()
  210. Release(plr)
  211. end)
  212. table.insert(Leashed, plr)
  213. end
  214.  
  215. local selecteduser = nil
  216.  
  217. local NewGuiPart1 = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
  218.  
  219. local NewGuiPart2 = Instance.new("TextLabel")
  220. NewGuiPart2.Size = UDim2.new(0, 300, 0, 20)
  221. NewGuiPart2.Position = UDim2.new(0.5, -150, 0.4, -10)
  222. NewGuiPart2.Font = Enum.Font.Bodoni
  223. NewGuiPart2.FontSize = Enum.FontSize.Size14
  224. NewGuiPart2.Text = "Leash Gui"
  225. NewGuiPart2.TextScaled = true
  226. NewGuiPart2.TextWrapped = true
  227. NewGuiPart2.Draggable = true
  228. NewGuiPart2.Active = true
  229. NewGuiPart2.Parent = NewGuiPart1
  230. NewGuiPart2.BackgroundTransparency = 0.6
  231. NewGuiPart2.BorderSizePixel = 0
  232. NewGuiPart2.TextColor3 = Color3.new(1,1,1)
  233.  
  234. local NewGuiPart3 = Instance.new("Frame")
  235. NewGuiPart3.Name = "Main"
  236. NewGuiPart3.Position = UDim2.new(0, 0, 1, 0)
  237. NewGuiPart3.Size = UDim2.new(1, 0, 0, 150)
  238. NewGuiPart3.Parent = NewGuiPart2
  239. NewGuiPart3.BackgroundTransparency = 0.6
  240. NewGuiPart3.BorderSizePixel = 0
  241.  
  242. local NewGuiPart4 = Instance.new("TextButton")
  243. NewGuiPart4.Active = true
  244. NewGuiPart4.Name = "LeashEm"
  245. NewGuiPart4.Position = UDim2.new(0, 0, 1, -30)
  246. NewGuiPart4.Selectable = true
  247. NewGuiPart4.Size = UDim2.new(1, 0, 0, 30)
  248. NewGuiPart4.Style = Enum.ButtonStyle.Custom
  249. NewGuiPart4.Font = Enum.Font.Antique
  250. NewGuiPart4.FontSize = Enum.FontSize.Size14
  251. NewGuiPart4.Text = "Leash Em"
  252. NewGuiPart4.TextScaled = true
  253. NewGuiPart4.TextWrapped = true
  254. NewGuiPart4.Parent = NewGuiPart3
  255. NewGuiPart4.BackgroundTransparency = 0.6
  256. NewGuiPart4.BorderSizePixel = 0
  257. NewGuiPart4.TextColor3 = Color3.new(1,1,1)
  258.  
  259. local NewGuiPart5 = Instance.new("ScrollingFrame")
  260. NewGuiPart5.Name = "Players"
  261. NewGuiPart5.Selectable = true
  262. NewGuiPart5.Size = UDim2.new(1, 0, 0, 100)
  263. NewGuiPart5.ClipsDescendants = true
  264. NewGuiPart5.Parent = NewGuiPart3
  265. NewGuiPart5.BackgroundTransparency = 0.6
  266. NewGuiPart5.BorderSizePixel = 0
  267.  
  268. local ListUI = Instance.new("UIListLayout", NewGuiPart5)
  269.  
  270. local Selected = Instance.new("TextLabel", NewGuiPart4)
  271. Selected.Position = UDim2.new(0,0,0,-20)
  272. Selected.Size = UDim2.new(1,0,0,20)
  273. Selected.Text = "Selected: nil"
  274. Selected.BackgroundTransparency = 0.6
  275. Selected.BorderSizePixel = 0
  276. Selected.TextColor3 = Color3.new(1,1,1)
  277.  
  278. NewGuiPart4.MouseButton1Down:connect(function()
  279. local found = false
  280. for i,v in pairs(Leashed) do
  281. if selecteduser == v then
  282. found = true
  283. end
  284. end
  285. if found then
  286. Release(selecteduser)
  287. else
  288. if selecteduser ~= nil then
  289. if game.Players:FindFirstChild(selecteduser) then
  290. wait()
  291. Capture(selecteduser)
  292. end
  293. end
  294. end
  295. end)
  296.  
  297. function Capture(user)
  298. local char = user
  299. if LockFirstPerson then
  300. if game.Players:FindFirstChild(char) then
  301. game.Players[char].CameraMode = "LockFirstPerson"
  302. end
  303. end
  304. TP(char)
  305. NewGuiPart4.Text = "Release"
  306. NewGuiPart5[char].BackgroundColor3 = Color3.new(0.5,1,0.5)
  307. wait()
  308. leash(char)
  309. end
  310.  
  311. function TP(plr)
  312. game.Players[plr].Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0,1,-4) * CFrame.Angles(0,math.rad(180),0)
  313. end
  314.  
  315. function Release(plr)
  316. local found = false
  317. local pos = 0
  318. for i,v in pairs(Leashed) do
  319. if v == plr then
  320. found = true
  321. pos = i
  322. end
  323. end
  324. if found then
  325. local player = game.Players[plr].Character
  326. player.Head[plr.."Neck"]:Destroy()
  327. Master["Left Arm"][plr.."Pole"]:Destroy()
  328. game.Players[plr].Character.Torso[plr.."BodyGyro1"]:Destroy()
  329. Master.Torso[plr.."BodyGyro2"]:Destroy()
  330. Master["Left Arm"][plr.."Leash"]:Destroy()
  331. local rootpart = game.Players.LocalPlayer.PlayerScripts[plr.."HumanoidRootPart"]
  332. rootpart.Name = "HumanoidRootPart"
  333. rootpart.Parent = player
  334. player.Humanoid.WalkSpeed = 16
  335. player.Humanoid.PlatformStand = false
  336. player.Humanoid.Sit = false
  337. if not LeaveCollar or not RealisticMode then
  338. player.Head[plr.."Collar"]:Destroy()
  339. end
  340. game.Players[plr].CameraMode = "Classic"
  341. NewGuiPart4.Text = "Leash Em"
  342. NewGuiPart5.Visible = true
  343. NewGuiPart5[plr].BackgroundColor3 = Color3.new(1,0.5,0.5)
  344. table.remove(Leashed, pos)
  345. wait()
  346. TP(selecteduser)
  347. end
  348. end
  349.  
  350. function playerbuttons(name)
  351. local button = Instance.new("TextButton", NewGuiPart5)
  352. button.Size = UDim2.new(1, 0, 0, 25)
  353. button.BackgroundColor3 = Color3.new(1,0.5,0.5)
  354. button.TextColor3 = Color3.new(0.9,0.9,0.9)
  355. button.BorderSizePixel = 0
  356. button.BackgroundTransparency = 0.7
  357. button.TextScaled = true
  358. button.Text = name
  359. button.Name = name
  360. button.MouseButton1Down:connect(function()
  361. Selected.Text = "Selected: "..name
  362. selecteduser = name
  363. checkleashed(name)
  364. end)
  365. NewGuiPart5.CanvasSize = UDim2.new(0,0,0, NewGuiPart5.CanvasSize.Y.Offset + 25)
  366. end
  367.  
  368. function checkleashed(plr)
  369. if NewGuiPart5:FindFirstChild(plr) then
  370. local found = false
  371. for i,v in pairs(Leashed) do
  372. if v == plr then
  373. found = true
  374. end
  375. end
  376. if found then
  377. NewGuiPart4.Text = "Release"
  378. else
  379. NewGuiPart4.Text = "Leash em"
  380. end
  381. end
  382. end
  383.  
  384. if not RealisticMode then
  385. game.Players.ChildAdded:connect(function(thing)
  386. UpdateList()
  387. end)
  388. end
  389.  
  390. game.Players.ChildRemoved:connect(function(thing)
  391. UpdateList()
  392. end)
  393.  
  394.  
  395. local LocalPlayer = owner
  396.  
  397. if RealisticMode then
  398. Mouse.Button1Down:connect(function()
  399. local found = false
  400. local hit = Mouse.Target
  401. local AlreadyIn = false
  402.  
  403. for i,v in pairs(Leashed)do
  404. if hit.Parent.Name == v then
  405. found = true
  406. end
  407. end
  408. if not found then
  409. if hit ~= nil then
  410. if hit.Parent:FindFirstChildOfClass("Humanoid") then
  411. if hit.Parent.Head:FindFirstChild("Collar") then
  412. AlreadyIn = true
  413. end
  414. if not AlreadyIn then
  415. local Collar = Instance.new("Part")
  416. Collar.Size = Vector3.new(1,0.2,1)
  417. Collar.CanCollide = false
  418. Collar.Name = "Collar"
  419. Collar.Transparency = 0
  420. Collar.BrickColor = BrickColor.Black()
  421.  
  422. local CollarMesh = Instance.new("CylinderMesh", Collar)
  423. CollarMesh.Scale = Vector3.new(1.2,0.8,1.2)
  424.  
  425. local Weld6 = Instance.new("Weld")
  426. Weld6.Parent = Collar
  427. Weld6.Part0 = Collar
  428. Weld6.Part1 = hit.Parent:FindFirstChild("Head")
  429. Weld6.C0 = CFrame.new(0,0.5,0)
  430.  
  431. Collar.Parent = hit.Parent:FindFirstChild("Head")
  432. print('Complete!')
  433. table.insert(Players, hit.Parent.Name)
  434. UpdateList()
  435. else
  436. local Collar = hit.Parent.Head:FindFirstChild("Collar")
  437. Collar:Destroy()
  438. for i,v in pairs(Players) do
  439. if v == hit.Parent.Name then
  440. table.remove(Players, i)
  441. end
  442. end
  443. UpdateList()
  444. end
  445. end
  446. end
  447. end
  448. end)
  449. end
  450.  
  451. function UpdateList()
  452. NewGuiPart5.CanvasSize = UDim2.new(0,0,0,0)
  453. for i,v in pairs(NewGuiPart5:GetChildren()) do
  454. if v.ClassName == "TextButton" then
  455. v:Destroy()
  456. end
  457. end
  458. for i,v in pairs(Leashed) do
  459. if not game.Players:FindFirstChild(v) then
  460. Master["Left Arm"][v.."Pole"]:Destroy()
  461. Master.Torso[v.."BodyGyro2"]:Destroy()
  462. Master["Left Arm"][v.."Leash"]:Destroy()
  463. game.Players.LocalPlayer.PlayerScripts[v.."HumanoidRootPart"]:Destroy()
  464. table.remove(Leashed, i)
  465. end
  466. if NewGuiPart5:FindFirstChild(v) then
  467. NewGuiPart5[v].BackgroundColor3 = Color3.new(0.5,1,0.5)
  468. end
  469. end
  470. if RealisticMode then
  471. for i,v in pairs(Players) do
  472. if game.Players:FindFirstChild(v) then
  473. playerbuttons(v)
  474. end
  475. end
  476. else
  477. for i,v in pairs(game.Players:GetChildren()) do
  478. if v.Name ~= game.Players.LocalPlayer.Name then
  479. playerbuttons(v.Name)
  480. end
  481. end
  482. end
  483. for i,v in pairs(Leashed)do
  484. if NewGuiPart5:FindFirstChild(v) then
  485. NewGuiPart5[v].BackgroundColor3 = Color3.new(0.5,1,0.5)
  486. end
  487. end
  488.  
  489.  
  490. end
  491.  
  492. function diething()
  493. game.Players.LocalPlayer.Character.Humanoid.Died:connect(function()
  494. wait(4.9)
  495. NewGuiPart1.Parent = game.Players.LocalPlayer.PlayerScripts
  496. game.Players.LocalPlayer.CharacterAdded:connect(function(character)
  497. NewGuiPart1.Parent = game.Players.LocalPlayer.PlayerGui
  498. diething()
  499. wait(0.1)
  500. end)
  501. end)
  502. end
  503.  
  504. UpdateList()
  505. if KeepWhenDie then
  506. wait(1)
  507. diething()
  508. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement