sawgamer1

Untitled

Jul 3rd, 2019
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.89 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
  6.  
  7.  
  8. --Converted with ttyyuu12345's model to script plugin v4
  9. function sandbox(var,func)
  10. local env = getfenv(func)
  11. local newenv = setmetatable({},{
  12. __index = function(self,k)
  13. if k=="script" then
  14. return var
  15. else
  16. return env[k]
  17. end
  18. end,
  19. })
  20. setfenv(func,newenv)
  21. return func
  22. end
  23. cors = {}
  24. mas = Instance.new("Model",game:GetService("Lighting"))
  25. Tool0 = Instance.new("Tool")
  26. Script1 = Instance.new("Script")
  27. Script2 = Instance.new("Script")
  28. Script3 = Instance.new("Script")
  29. LocalScript4 = Instance.new("LocalScript")
  30. Script5 = Instance.new("Script")
  31. LocalScript6 = Instance.new("LocalScript")
  32. Tool0.Name = "Detain"
  33. Tool0.Parent = mas
  34. Tool0.RequiresHandle = false
  35. Script1.Name = "Server"
  36. Script1.Parent = Tool0
  37. table.insert(cors,sandbox(Script1,function()
  38. for i,v in pairs(script:GetChildren()) do
  39. if not game.ServerScriptService:FindFirstChild(v.Name) then
  40. local v = v:Clone()
  41. v.Parent = game.ServerScriptService
  42. local a = Instance.new("StringValue", v)
  43. a.Name = "toolname"
  44. a.Value = script.Parent.Name
  45. v.Disabled = false
  46. end
  47. end
  48. end))
  49. Script2.Name = "Arrest Function"
  50. Script2.Parent = Script1
  51. table.insert(cors,sandbox(Script2,function()
  52. local a = Instance.new("RemoteFunction", game.ReplicatedStorage)
  53.  
  54. a.OnServerInvoke = function(plr, plr2)
  55. if plr.Character:FindFirstChild(script.toolname.Value) then
  56. if not plr:FindFirstChild("ArrestedBy") then
  57. if plr2 then
  58.  
  59. if (plr.Character:WaitForChild("Torso").Position - plr2.Character:WaitForChild("Torso").Position).magnitude <= 15 then
  60. if plr:FindFirstChild("ArrestedPerson") then
  61. plr.ArrestedPerson:Destroy()
  62. end
  63. if plr2:FindFirstChild("ArrestedPerson") then
  64. plr2.ArrestedPerson:Destroy()
  65. end
  66. if plr2:FindFirstChild("ArrestedBy") then
  67. plr2.ArrestedBy:Destroy()
  68. end
  69.  
  70. for i,v in pairs(game.Players:GetChildren()) do
  71. local a = v:FindFirstChild("ArrestedBy")
  72. if a then
  73. if a.Value == plr then
  74. a:Destroy()
  75. end
  76. end
  77. end
  78.  
  79. for i,v in pairs(game.Players:GetChildren()) do
  80. local a = v:FindFirstChild("ArrestedPerson")
  81. if a then
  82. if a.Value == plr then
  83. a:Destroy()
  84. end
  85. end
  86. end
  87.  
  88. for i,v in pairs(game.Players:GetChildren()) do
  89. local a = v:FindFirstChild("ArrestedBy")
  90. if a then
  91. if a.Value == plr2 then
  92. a:Destroy()
  93. end
  94. end
  95. end
  96.  
  97. for i,v in pairs(game.Players:GetChildren()) do
  98. local a = v:FindFirstChild("ArrestedPerson")
  99. if a then
  100. if a.Value == plr2 then
  101. a:Destroy()
  102. end
  103. end
  104. end
  105.  
  106.  
  107. local a = Instance.new("ObjectValue", plr)
  108. a.Value = plr2
  109. a.Name = "ArrestedPerson"
  110.  
  111. local b = Instance.new("ObjectValue", plr2)
  112. b.Value = plr
  113. b.Name = "ArrestedBy"
  114.  
  115. if plr2.Character then
  116. local h = plr2.Character:FindFirstChild("Humanoid")
  117. if h then
  118. h:UnequipTools()
  119. wait()
  120. h:UnequipTools()
  121. end
  122. end
  123. end
  124.  
  125. else
  126.  
  127. if plr:FindFirstChild("ArrestedPerson") then
  128. plr.ArrestedPerson:Destroy()
  129. end
  130.  
  131. for i,v in pairs(game.Players:GetChildren()) do
  132. local a = v:FindFirstChild("ArrestedBy")
  133. if a then
  134. if a.Value == plr then
  135. a:Destroy()
  136. end
  137. end
  138. end
  139.  
  140. end
  141. end
  142. end
  143. end
  144.  
  145. a.Name = "ArrestFunction"
  146. end))
  147. Script2.Disabled = true
  148. Script3.Name = "Arrest Handler"
  149. Script3.Parent = Script1
  150. table.insert(cors,sandbox(Script3,function()
  151. function RunOnPlayer(plr)
  152. plr.CharacterAdded:connect(function(char)
  153. local humanoid = char:WaitForChild("Humanoid")
  154. humanoid.Died:connect(function()
  155. if plr:FindFirstChild("ArrestedPerson") then
  156. plr.ArrestedPerson:Destroy()
  157. for i,v in pairs(game.Players:GetChildren()) do
  158. local a = v:FindFirstChild("ArrestedBy")
  159. if a then
  160. if a.Value == plr then
  161. a:Destroy()
  162. end
  163. end
  164. end
  165. end
  166. end)
  167. end)
  168.  
  169. if plr.Character then
  170. local humanoid = plr.Character:FindFirstChild("Humanoid")
  171. if humanoid then
  172. humanoid.Died:connect(function()
  173. if plr:FindFirstChild("ArrestedPerson") then
  174. plr.ArrestedPerson:Destroy()
  175. for i,v in pairs(game.Players:GetChildren()) do
  176. local a = v:FindFirstChild("ArrestedBy")
  177. if a then
  178. if a.Value == plr then
  179. a:Destroy()
  180. end
  181. end
  182. end
  183. end
  184. end)
  185. end
  186. end
  187.  
  188.  
  189.  
  190. game:GetService("RunService").Stepped:connect(function()
  191. if plr:FindFirstChild("ArrestedBy") then
  192. local a = plr:FindFirstChild("ArrestedBy")
  193. if a and a.Value and a.Value.Character then
  194. local torso2 = a.Value.Character:FindFirstChild("HumanoidRootPart")
  195.  
  196. if plr and plr.Character then
  197. local torso = plr.Character:FindFirstChild("HumanoidRootPart")
  198. if torso and torso2 then
  199. torso.CFrame = torso2.CFrame * CFrame.new(0,0,-7)
  200. end
  201. end
  202. end
  203. end
  204. end)
  205. end
  206.  
  207.  
  208. for i,v in pairs(game.Players:GetPlayers()) do
  209. RunOnPlayer(v)
  210. end
  211.  
  212. game.Players.PlayerAdded:connect(RunOnPlayer)
  213. end))
  214. Script3.Disabled = true
  215. LocalScript4.Parent = Tool0
  216. table.insert(cors,sandbox(LocalScript4,function()
  217. local function UnArrest()
  218. game.ReplicatedStorage:WaitForChild("ArrestFunction"):InvokeServer()
  219. end
  220.  
  221.  
  222.  
  223. script.Parent.Activated:connect(function()
  224. local m = game.Players.LocalPlayer:GetMouse()
  225. if m then
  226. local t = m.Target
  227. if t and t.Parent then
  228. local plr = game.Players:GetPlayerFromCharacter(t.Parent)
  229. if plr and plr ~= game.Players.LocalPlayer then
  230. game.ReplicatedStorage:WaitForChild("ArrestFunction"):InvokeServer(plr)
  231. else
  232. UnArrest()
  233. end
  234. else
  235. UnArrest()
  236. end
  237. end
  238. end)
  239.  
  240.  
  241. script.Parent.Unequipped:connect(function()
  242. UnArrest()
  243. end)
  244. end))
  245. Script5.Name = "Client"
  246. Script5.Parent = Tool0
  247. table.insert(cors,sandbox(Script5,function()
  248. for i,v in pairs(script:GetChildren()) do
  249. if not game.StarterPack:FindFirstChild(v.Name) then
  250. local x = v:Clone()
  251. x.Parent = game.StarterPack
  252. x.Disabled = false
  253.  
  254. coroutine.wrap(function()
  255. wait(1)
  256. if not script.Parent.Parent:FindFirstChild(v.Name) then
  257. local x = v:Clone()
  258. x.Parent = script.Parent.Parent
  259. x.Disabled = false
  260. end
  261. end)()
  262. end
  263. end
  264. end))
  265. LocalScript6.Name = "Arrested Function"
  266. LocalScript6.Parent = Script5
  267. table.insert(cors,sandbox(LocalScript6,function()
  268. local a = 0
  269. for i,v in pairs(script.Parent:GetChildren()) do
  270. if v.Name == script.Name then
  271. a = a + 1
  272. end
  273. end
  274. if a > 1 then
  275. a:Destroy()
  276. end
  277.  
  278.  
  279. game:GetService("RunService"):BindToRenderStep("arresttool", 0, function()
  280. local plr = game.Players.LocalPlayer
  281. if plr then
  282. local char = plr.Character
  283. if char and char.Parent then
  284. local torso = char:FindFirstChild("HumanoidRootPart")
  285. if torso then
  286. local arrestedby = plr:FindFirstChild("ArrestedBy")
  287. local arrestedperson = plr:FindFirstChild("ArrestedPerson")
  288.  
  289. if arrestedby and arrestedby.Value and arrestedby.Value.Character then
  290. local torso2 = arrestedby.Value.Character:FindFirstChild("HumanoidRootPart")
  291. if torso2 then
  292. torso.CFrame = torso2.CFrame * CFrame.new(0,0,-7)
  293. end
  294. end
  295.  
  296. if arrestedperson and arrestedperson.Value and arrestedperson.Value.Character then
  297. local torso2 = arrestedperson.Value.Character:FindFirstChild("HumanoidRootPart")
  298. if torso2 then
  299. torso2.CFrame = torso.CFrame * CFrame.new(0,0,-7)
  300. end
  301. end
  302. end
  303. end
  304. end
  305. end)
  306. end))
  307. LocalScript6.Disabled = true
  308. for i,v in pairs(mas:GetChildren()) do
  309. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  310. pcall(function() v:MakeJoints() end)
  311. end
  312. mas:Destroy()
  313. for i,v in pairs(cors) do
  314. spawn(function()
  315. pcall(v)
  316. end)
  317. end
Advertisement
Add Comment
Please, Sign In to add comment