Advertisement
Bendy928443534

john doe

Jul 5th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.48 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. repeat wait() until script:WaitForChild'Owner'.Value
  38. local Player = script:WaitForChild'Owner'.Value
  39. script.Owner:destroy()
  40. repeat wait() until Player.Character
  41. local scriptName = "Corruption"
  42. local stopped=false
  43. local remotes;
  44. function WaitForChildOfClass(where,class,timeout)
  45. local start = tick();
  46. local ret;
  47. repeat ret=where:FindFirstChildOfClass(class) wait() until ret or tick()-start>=(timeout or 15)
  48. if(not ret)then warn("timeout") repeat wait()until nil else return ret end
  49. end
  50.  
  51. local GUID = {}
  52. do
  53. GUID.IDs = {};
  54. function GUID:new(len)
  55. local id;
  56. if(not len)then
  57. id = (tostring(function() end))
  58. id = id:gsub("function: ","")
  59. else
  60. local function genID(len)
  61. local newID = ""
  62. for i = 1,len do
  63. newID = newID..string.char(math.random(48,90))
  64. end
  65. return newID
  66. end
  67. repeat id = genID(len) until not GUID.IDs[id]
  68. local oid = id;
  69. id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  70. GUID.IDs[oid]=true;
  71. end
  72. return id
  73. end
  74. end
  75.  
  76. local instanceID = GUID:new()
  77.  
  78. local Replicated = script:WaitForChild'Replication':Clone();
  79. script.Replication:Destroy()
  80. local GUID = {}
  81. do
  82. GUID.IDs = {};
  83. function GUID:new(len)
  84. local id;
  85. if(not len)then
  86. id = (tostring(function() end))
  87. id = id:gsub("function: ","")
  88. else
  89. local function genID(len)
  90. local newID = ""
  91. for i = 1,len do
  92. newID = newID..string.char(math.random(48,90))
  93. end
  94. return newID
  95. end
  96. repeat id = genID(len) until not GUID.IDs[id]
  97. local oid = id;
  98. id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  99. GUID.IDs[oid]=true;
  100. end
  101. return id
  102. end
  103. end
  104.  
  105.  
  106. local fakeEvent = function()
  107. local t = {_fakeEvent=true,Waited={},Connected={}}
  108. t.Connect = function(self,f)
  109. local ft={}
  110. ft={Disconnected=false;disconnect=function(s) if(self.Function==ft)then self.Function=nil end s.Disconnected=true end}
  111. ft.Disconnect=ft.disconnect
  112.  
  113. ft.Func=function(...)
  114. for id,_ in next, t.Waited do
  115. t.Waited[id] = true
  116. end
  117. return f(...)
  118. end;
  119.  
  120. table.insert(self.Connected,ft)
  121. return ft;
  122. end
  123. t.connect = t.Connect
  124. t.Wait = function()
  125. local guid = GUID:new(25)
  126. local waitingId = guid:Get()
  127. t.Waited[waitingId]=false
  128. repeat wait() until t.Waited[waitingId]==true
  129. t.Waited[waitingId]=nil;
  130. guid:Trash()
  131. end
  132. t.wait = t.Wait
  133. return t
  134. end
  135.  
  136. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  137. local UsIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  138. local function te(self,ev,...)
  139. local t = self[ev]
  140. if t and t._fakeEvent and t.Connected then
  141. for i,v in next, t.Connected do
  142. if(v.Func and not v.Disconnected)then
  143. v.Func(...)
  144. else
  145. t.Connected[i]=nil
  146. end
  147. end
  148. end
  149. end
  150. m.TrigEvent = te
  151. UsIS.TrigEvent = te
  152.  
  153. NewInstance = function(instance,parent,properties)
  154. local inst = Instance.new(instance)
  155. inst.Parent = parent
  156. if(properties)then
  157. for i,v in next, properties do
  158. pcall(function() inst[i] = v end)
  159. end
  160. end
  161. return inst;
  162. end
  163.  
  164. local CF={N=CFrame.new,A=CFrame.Angles}
  165.  
  166. local Head = Player.Character:WaitForChild'Head'
  167. local Torso = Player.Character:WaitForChild'Torso'
  168. local LArm = Player.Character:WaitForChild'Left Arm'
  169. local RArm = Player.Character:WaitForChild'Right Arm'
  170. local LLeg = Player.Character:WaitForChild'Left Leg'
  171. local RLeg = Player.Character:WaitForChild'Right Leg'
  172. local Root = Player.Character:WaitForChild'HumanoidRootPart'
  173.  
  174. function newMotor(P0,P1,C0,C1)
  175. return NewInstance('Motor',P0,{Part0=P0,Part1=P1,C0=C0,C1=C1})
  176. end
  177.  
  178. local welds = {}
  179. local vars = {}
  180. local Hit = {}
  181.  
  182.  
  183. table.insert(welds,newMotor(Torso,Head,CF.N(0,1.5,0),CF.N()))
  184. table.insert(welds,newMotor(Root,Torso,CF.N(),CF.N()))
  185. table.insert(welds,newMotor(Torso,RLeg,CF.N(.5,-1,0),CF.N(0,1,0)))
  186. table.insert(welds,newMotor(Torso,RArm,CF.N(1.5,.5,0),CF.N(0,.5,0)))
  187. table.insert(welds,newMotor(Torso,LLeg,CF.N(-.5,-1,0),CF.N(0,1,0)))
  188. table.insert(welds,newMotor(Torso,LArm,CF.N(-1.5,.5,0),CF.N(0,.5,0)))
  189.  
  190. vars.WeldDefaults={}
  191. for i = 1,#welds do
  192. local v=welds[i]
  193. vars.WeldDefaults[i]=v.C0
  194. end
  195.  
  196. function GetTorso(char)
  197. return char:FindFirstChild'Torso' or char:FindFirstChild'UpperTorso' or char:FindFirstChild'LowerTorso' or char:FindFirstChild'HumanoidRootPart'
  198. end
  199.  
  200.  
  201. function DealDamage(data)
  202. local Who = data.Who;
  203. local MinDam = data.MinimumDamage or 15;
  204. local MaxDam = data.MaximumDamage or 30;
  205. local MaxHP = data.MaxHP or 1e5;
  206. local DamageColor = data.DamageColor or BrickColor.new'Really red'
  207.  
  208. local DB = data.Debounce or .2;
  209.  
  210. local CritData = data.Crit or {}
  211. local CritChance = CritData.Chance or 0;
  212. local CritMultiplier = CritData.Multiplier or 1;
  213.  
  214. local DamageEffects = data.DamageFX or {}
  215. local DeathEffect = DamageEffects.DeathEffect
  216.  
  217. assert(Who,"Specify someone to damage!")
  218.  
  219. local Humanoid = Who:FindFirstChildOfClass'Humanoid'
  220. local DoneDamage = math.random(MinDam,MaxDam) * (math.random(1,100) <= CritChance and CritMultiplier or 1)
  221. local remotes = Player.Character:WaitForChild(instanceID.."Remotes")
  222.  
  223. local canHit = true
  224. if(Humanoid)then
  225. for _, p in next, Hit do
  226. if p[1] == Humanoid then
  227. if(time() - p[2] <= DB) then
  228. canHit = false
  229. else
  230. Hit[_] = nil
  231. end
  232. end
  233. end
  234. if(canHit)then
  235. table.insert(Hit,{Humanoid,time()})
  236. local HitTorso = GetTorso(Who)
  237. local player = game:service'Players':GetPlayerFromCharacter(Who)
  238. if(Player.UserId == 5719877 or not player or player.UserId ~= 5719877 and player.UserId ~= 61573184 and player.UserId ~= 19081129)then
  239. if(Humanoid.MaxHealth >= MaxHP and Humanoid.Health > 0)then
  240. print'Got kill'
  241. Humanoid.Health = 0;
  242. Who:BreakJoints();
  243. if(DeathEffect)then remotes:WaitForChild'Pusher':FireAllClients(DeathEffect,Who,Humanoid) end
  244.  
  245. else
  246. local c = Instance.new("ObjectValue",Humanoid)
  247. c.Name = "creator"
  248. c.Value = Player
  249. game:service'Debris':AddItem(c,0.35)
  250. if(Who:FindFirstChild'Head' and Humanoid.Health > 0)then
  251. remotes:WaitForChild'Pusher':FireAllClients('ShowDamage',(Who.Head.CFrame * CF.N(0, 0, (Who.Head.Size.Z / 2)).p+Vector3.new(0,1.5,0)+Vector3.new(math.random(-2,2),0,math.random(-2,2))),DoneDamage,1.5,DamageColor.Color)
  252. end
  253. if(Humanoid.Health > 0 and Humanoid.Health-DoneDamage <= 0)then print'Got kill' if(DeathEffect)then remotes:WaitForChild'Pusher':FireAllClients(DeathEffect,Who,Humanoid) end end
  254. Humanoid.Health = Humanoid.Health - DoneDamage
  255. end
  256. end
  257. end
  258. end
  259. end
  260.  
  261.  
  262. function SetupRemotes(name)
  263. local ch = Player.Character
  264. local RemoteFolder = Instance.new("Folder",Player.Character)
  265. RemoteFolder.Name=name..'Remotes'
  266. local Pull = Instance.new("RemoteFunction",RemoteFolder)
  267. Pull.Name = 'Puller'
  268. Pull.OnServerInvoke = function(player,request,...)
  269. if(stopped)then return end
  270. if(request=='Welds')then
  271. return welds
  272. elseif(request=='Character')then
  273. return ch
  274. elseif(vars[request])then
  275. return vars[request]
  276. end
  277. end
  278. local Push = Instance.new("RemoteEvent",RemoteFolder)
  279. Push.Name = 'Pusher'
  280. Push.OnServerEvent:connect(function(player,request,...)
  281. local varargs={...}
  282. if(stopped)then return end
  283. if(request=='MouseEventCall')then
  284. local event = table.remove(varargs,1)
  285. if(m[event])then
  286. Push:FireAllClients(event,unpack(varargs))
  287. m:TrigEvent(event,unpack(varargs))
  288. end
  289. elseif(request=='MouseUpdate')then
  290. m.Target = varargs[1].Target
  291. m.Hit = varargs[1].Hit
  292. Push:FireAllClients("UpdatePos",m.Target,m.Hit)
  293. elseif(request=='Damage')then
  294. DealDamage(...)
  295. elseif(request=='Kill')then
  296. varargs[1]:BreakJoints()
  297. elseif(request=='Broadcast')then
  298. Push:FireAllClients(unpack(varargs))
  299. elseif(request=='SetVariable')then
  300. if(varargs[1])then
  301. vars[varargs[1]]=varargs[2]
  302. end
  303. elseif(request=='SetVariableAndBroadcast')then
  304. vars[varargs[1]]=varargs[2]
  305. Push:FireAllClients(unpack(varargs))
  306. elseif(request=='Drag')then
  307. --hitto,CFrame.new(Handle.Position)
  308. varargs[1].CFrame = varargs[2]
  309. end
  310. end)
  311.  
  312. local removing=false
  313. local signal;
  314. signal=RemoteFolder.AncestryChanged:connect(function()
  315. if((RemoteFolder.Parent~=ch or Push.Parent~=RemoteFolder or Pull.Parent~=RemoteFolder) and not removing)then
  316. removing=true
  317. signal:disconnect()
  318. RemoteFolder:Destroy()
  319. SetupRemotes(name)
  320. end
  321. end)
  322. remotes=RemoteFolder
  323. end
  324.  
  325. -- MODIFIABLE STUFF --
  326.  
  327.  
  328.  
  329. -- STOP MODIFIABLE STUFF --
  330. local signals = {} -- for l8r (stop commands, etc)
  331. local scripts = {}
  332.  
  333. function BreakSignal(signalOrName)
  334. for name,signal in next, signals do
  335. if(typeof(signalOrName)~='RBXScriptSignal' and name==signalOrName or signal==signalOrName)then
  336. signal:disconnect()
  337. signals[name]=nil
  338. break
  339. end
  340. end
  341. end
  342. local Hum;
  343. repeat wait() Hum=Player.Character:FindFirstChildOfClass'Humanoid' until Hum
  344. for _,v in next, Hum:GetPlayingAnimationTracks() do
  345. v:Stop(0);
  346. end
  347.  
  348. pcall(game.Destroy,Player.Character:FindFirstChild'Animate')
  349. pcall(game.Destroy,Hum:FindFirstChild'Animator')
  350.  
  351. function GiveScript(who)
  352. local pgui = WaitForChildOfClass(who,'PlayerGui')
  353. local scr = Replicated:Clone();
  354. scr.Name=instanceID
  355. scr.Parent = pgui
  356. scripts[who]=scr
  357. if(scr:FindFirstChild'Owner')then scr:WaitForChild'Owner'.Value = Player end
  358. scr.Disabled = false
  359. local signal;
  360. signal = pgui.DescendantRemoving:connect(function(o)
  361. wait()
  362. if(stopped)then BreakSignal(signal) return end
  363. if(scr.Parent~=pgui and not scr.Disabled)then
  364. local reparenting = pcall(function() scr.Parent=pgui end)
  365. if(not reparenting)then
  366. scr.Disabled=true
  367. BreakSignal(signal)
  368. scr:destroy()
  369. GiveScript(who)
  370. return
  371. end
  372. end
  373. end)
  374. signals[who.Name]=signal
  375. end
  376.  
  377. function stop()
  378. warn("Stopped "..scriptName)
  379. stopped=true
  380. for _,v in next, signals do
  381. BreakSignal(v)
  382. end
  383. remotes:WaitForChild'Pusher':FireAllClients("stop")
  384. remotes:destroy()
  385. for _,v in next, scripts do
  386. v.Disabled=true
  387. v:destroy()
  388. end
  389. script:Destroy()
  390. end
  391. function connect(v)
  392. if(stopped)then return end
  393. if(v==Player and not v.Character:FindFirstChild(instanceID.."Remotes"))then
  394. SetupRemotes(instanceID)
  395. end
  396. v.CharacterAdded:connect(function()
  397. GiveScript(v)
  398. if(v==Player)then
  399. SetupRemotes(instanceID)
  400. delay(.3,function() stop() end)
  401. end
  402. end)
  403. if(v.Character)then GiveScript(v) end
  404. if(v==Player)then
  405. v.Chatted:connect(function(c)
  406. if(c:lower()=="stopscript-")then
  407. stop()
  408. end
  409. end)
  410. end
  411. end
  412.  
  413. for _,v in next, game:service'Players':players() do
  414. connect(v)
  415. end
  416.  
  417. game:service'Players'.PlayerAdded:connect(connect)
  418. game:service'Players'.PlayerRemoving:connect(function(p)
  419. if(p==Player)then
  420. stop()
  421. end
  422. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement