Advertisement
hugedkslkdjsjhdfhjdf

code

Nov 13th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.79 KB | None | 0 0
  1. local RealPlayer = game:GetService("Players"):GetPlayerFromCharacter(script.Parent)
  2. local FakeMouse = script.FakeMouse:Clone();
  3. FakeMouse.Parent = RealPlayer.Character;
  4. script.FakeMouse:Destroy()
  5. do
  6. local GUID = {}
  7. do
  8. GUID.IDs = {};
  9. function GUID:new(len)
  10. local id;
  11. if(not len)then
  12. id = (tostring(function() end))
  13. id = id:gsub("function: ","")
  14. else
  15. local function genID(len)
  16. local newID = ""
  17. for i = 1,len do
  18. newID = newID..string.char(math.random(48,90))
  19. end
  20. return newID
  21. end
  22. repeat id = genID(len) until not GUID.IDs[id]
  23. local oid = id;
  24. id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  25. GUID.IDs[oid]=true;
  26. end
  27. return id
  28. end
  29. end
  30.  
  31. local AHB = Instance.new("BindableEvent")
  32.  
  33. local FPS = 30
  34.  
  35. local TimeFrame = 0
  36.  
  37. local LastFrame = tick()
  38. local Frame = 1/FPS
  39.  
  40. game:service'RunService'.Heartbeat:connect(function(s,p)
  41. TimeFrame = TimeFrame + s
  42. if(TimeFrame >= Frame)then
  43. for i = 1,math.floor(TimeFrame/Frame) do
  44. AHB:Fire()
  45. end
  46. LastFrame=tick()
  47. TimeFrame=TimeFrame-Frame*math.floor(TimeFrame/Frame)
  48. end
  49. end)
  50.  
  51.  
  52. function swait(dur)
  53. if(dur == 0 or typeof(dur) ~= 'number')then
  54. AHB.Event:wait()
  55. else
  56. for i = 1, dur*FPS do
  57. AHB.Event:wait()
  58. end
  59. end
  60. end
  61.  
  62. local oPlayer = RealPlayer
  63. local Player = oPlayer
  64.  
  65. local loudnesses={}
  66. script.Parent = Player.Character
  67. local CoAS = {Actions={}}
  68. local Event = Instance.new("RemoteEvent")
  69. Event.Name = "UserInputEvent"
  70. Event.Parent = Player.Character
  71. local Func = Instance.new("RemoteFunction")
  72. Func.Name = "GetClientProperty"
  73. Func.Parent = Player.Character
  74. local fakeEvent = function()
  75. local t = {_fakeEvent=true,Waited={},Connected={}}
  76. t.Connect = function(self,f)
  77. local ft={}
  78. ft={Disconnected=false;disconnect=function(s) if(self.Function==ft)then self.Function=nil end s.Disconnected=true end}
  79. ft.Disconnect=ft.disconnect
  80.  
  81. ft.Func=function(...)
  82. for id,_ in next, t.Waited do
  83. t.Waited[id] = true
  84. end
  85. return f(...)
  86. end;
  87.  
  88. table.insert(self.Connected,ft)
  89. return ft;
  90. end
  91. t.connect = t.Connect
  92. t.Wait = function()
  93. local guid = GUID:new(25)
  94. local waitingId = guid:Get()
  95. t.Waited[waitingId]=false
  96. repeat swait() until t.Waited[waitingId]==true
  97. t.Waited[waitingId]=nil;
  98. guid:Trash()
  99. end
  100. t.wait = t.Wait
  101. return t
  102. end
  103. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  104. local UsIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  105. local Run = {RenderStepped=fakeEvent()}
  106.  
  107. function CoAS:BindAction(name,fun,touch,...)
  108. CoAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  109. end
  110. function CoAS:UnbindAction(name)
  111. CoAS.Actions[name] = nil
  112. end
  113. local function te(self,ev,...)
  114. local t = self[ev]
  115. if t and t._fakeEvent and t.Connected then
  116. for i,v in next, t.Connected do
  117. if(v.Func and not v.Disconnected)then
  118. v.Func(...)
  119. else
  120. t.Connected[i]=nil
  121. end
  122. end
  123. end
  124. end
  125. m.TrigEvent = te
  126. UsIS.TrigEvent = te
  127. Run.TrigEvent = te
  128. Event.OnServerEvent:Connect(function(plr,io)
  129. if plr~=Player then return end
  130. --[[table.foreach(io,print)
  131. print'---']]
  132. if io.Mouse then
  133. m.Target = io.Target
  134. m.Hit = io.Hit
  135. elseif io.KeyEvent then
  136. m:TrigEvent('Key'..io.KeyEvent,io.Key)
  137. elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  138. if io.UserInputState == Enum.UserInputState.Begin then
  139. m:TrigEvent("Button1Down")
  140. else
  141. m:TrigEvent("Button1Up")
  142. end
  143. end
  144. if(not io.KeyEvent and not io.Mouse)then
  145.  
  146. for n,t in pairs(CoAS.Actions) do
  147. for _,k in pairs(t.Keys) do
  148. if k==io.KeyCode then
  149. t.Function(t.Name,io.UserInputState,io)
  150. end
  151. end
  152. end
  153. if io.UserInputState == Enum.UserInputState.Begin then
  154. UsIS:TrigEvent("InputBegan",io,false)
  155. else
  156. UsIS:TrigEvent("InputEnded",io,false)
  157. end
  158. end
  159. end)
  160.  
  161. Func.OnServerInvoke = function(plr,inst,play)
  162. if plr~=Player then return end
  163. if(inst and typeof(inst) == 'Instance' and inst:IsA'Sound')then
  164. loudnesses[inst]=play
  165. end
  166. end
  167.  
  168. function GetClientProperty(inst,prop)
  169. if(prop == 'PlaybackLoudness' and loudnesses[inst])then
  170. return loudnesses[inst]
  171. elseif(prop == 'PlaybackLoudness')then
  172. return Func:InvokeClient(Player,'RegSound',inst)
  173. end
  174. return Func:InvokeClient(Player,inst,prop)
  175. end
  176. local oldGame = game;
  177. local oldPlayer = Player;
  178. local fakePlayer = newproxy(true)
  179. getmetatable(fakePlayer).__index = function(s,i)
  180. if(i == 'GetMouse')then
  181. return function() return m; end
  182. end
  183. return Player[i]
  184. end
  185. getmetatable(fakePlayer).__newindex = function(s,i,v)
  186. Player[i]=v
  187. end
  188. getmetatable(fakePlayer).__call=function(self,...)
  189. if(self == fakePlayer)then self = Player end
  190. local wh = {...}
  191. local name = table.remove(wh,1)
  192. for i,v in next, wh do
  193. wh[i]=v
  194. end
  195. if(name == 'GetMouse')then
  196. return m;
  197. end
  198. return self(name,unpack(wh))
  199. end
  200. getmetatable(fakePlayer).__namecall=function(self,...)
  201. if(self == fakePlayer)then self = Player end
  202. local tuple={...}
  203. local name = table.remove(tuple,#tuple)
  204.  
  205. if(name == 'GetMouse')then
  206. return m;
  207. else
  208. return self[name](self,unpack(tuple))
  209. end
  210. end
  211. local oll = LoadLibrary;
  212. function LoadLibrary(libtard)
  213. local libtarddestroyed=oll(libtard)
  214. if(libtard=='RbxUtility')then
  215. local library={Create=function(obj)
  216. local inst = Instance.new(obj)
  217. return function(props)
  218. for prop,valu in next, props do
  219. inst[prop]=valu
  220. end
  221. return inst
  222. end
  223. end}
  224. setmetatable(library,{__index=libtarddestroyed,__newindex=function(s,i,v) libtarddestroyed[i]=v end})
  225.  
  226. return library
  227. else
  228. return libtarddestroyed
  229. end
  230. end
  231. local function GetService(s,i)
  232. local service = s:GetService(i)
  233. if(i == 'Players')then
  234. local oldService = service;
  235. local fakeService = newproxy(true)
  236. getmetatable(fakeService).__index = function(s,i)
  237. if(s == fakeService)then s=oldService end
  238. if(i == 'LocalPlayer' or i == 'localPlayer')then
  239. return fakePlayer
  240. elseif(i == 'oPlayer')then
  241. return oPlayer
  242. else
  243. return s[i]
  244. end
  245. end
  246. getmetatable(fakeService).__newindex = function(s,i,v)
  247. if(s == fakeService)then s=oldService end
  248. s[i]=v
  249. end
  250. getmetatable(fakeService).__call=function(self,...)
  251. if(self == fakeService)then self = oldService end
  252. local wh = {...}
  253. local name = table.remove(wh,1)
  254. for i,v in next, wh do
  255. wh[i]=v
  256. end
  257. return self(name,unpack(wh))
  258. end
  259. getmetatable(fakeService).__namecall=function(self,...)
  260. if(self == fakeService)then self = oldService end
  261. local tuple={...}
  262. local name = table.remove(tuple,#tuple)
  263.  
  264. return self[name](self,unpack(tuple))
  265. end
  266. getmetatable(fakeService).__metatable = 'gay'
  267. return fakeService
  268. elseif(i == 'RunService')then
  269. local oldService = service;
  270. local fakeService = newproxy(true)
  271. getmetatable(fakeService).__index = function(s,i)
  272. if(s == fakeService)then s=oldService end
  273. return Run[i] or s[i]
  274. end
  275. getmetatable(fakeService).__newindex = function(s,i,v)
  276. if(s == fakeService)then s=oldService end
  277. s[i]=v
  278. end
  279. getmetatable(fakeService).__call=function(self,...)
  280. if(self == fakeService)then self = oldService end
  281. local wh = {...}
  282. local name = table.remove(wh,1)
  283. for i,v in next, wh do
  284. wh[i]=v
  285. end
  286. return self(name,unpack(wh))
  287. end
  288. getmetatable(fakeService).__namecall=function(self,...)
  289. if(self == fakeService)then self = oldService end
  290. local tuple={...}
  291. local name = table.remove(tuple,#tuple)
  292.  
  293. return self[name](self,unpack(tuple))
  294. end
  295. getmetatable(fakeService).__metatable = 'gay'
  296. return fakeService
  297. elseif(i == 'UserInputService')then
  298. return UsIS
  299. elseif(i == 'ContextActionService')then
  300. return CoAS;
  301. else
  302. return service
  303. end
  304. end
  305.  
  306. local new = Instance.new;
  307. Instance = {}
  308. Instance.new = function(inst,obje)
  309. local lp = GetService(oldGame,'Players').localPlayer
  310. local instance = new(inst)
  311. if(inst=='ObjectValue')then
  312. local fake = newproxy(true)
  313. getmetatable(fake).__index=function(self,index)
  314. if(self==fake)then self=instance end
  315. return self[index]
  316. end
  317. getmetatable(fake).__newindex=function(self,index,value)
  318. if(self==fake)then self=instance end
  319. if(index=='Value' and typeof(value)~='Instance' and value==fakePlayer)then
  320. self[index]=oPlayer
  321. else
  322. self[index]=value
  323. end
  324. end
  325. getmetatable(fake).__call=function(self,...)
  326. if(self == fake)then self = instance end
  327. local wh = {...}
  328. local name = table.remove(wh,1)
  329. for i,v in next, wh do
  330. if(v == fake)then v = instance end
  331. wh[i]=v
  332. end
  333. return self(name,unpack(wh))
  334. end
  335. getmetatable(fake). __namecall=function(self,...)
  336. if(self == fake)then self = instance end
  337. local tuple={...}
  338. local name = table.remove(tuple,#tuple)
  339. return self[name](self,unpack(tuple))
  340. end
  341. return fake
  342. else
  343. instance.Parent = obje
  344. return instance;
  345. end
  346.  
  347. end
  348. local serviceFunctions={
  349. service=true,
  350. GetService=true,
  351. }
  352. local fakeGame = newproxy(true)
  353. getmetatable(fakeGame).__index = function(s,i)
  354. if(s == fakeGame)then s=oldGame end
  355. local serv = GetService(oldGame,i)
  356. if serviceFunctions[i] then
  357. return GetService
  358. elseif(serv)then
  359. return serv
  360. else
  361. return s[i]
  362. end
  363. end
  364. getmetatable(fakeGame).__newindex = function(s,i,v)
  365. if(s == fakeGame)then s=oldGame end
  366. s[i]=v
  367. end
  368. getmetatable(fakeGame).__call=function(self,...)
  369. if(self == fakeGame)then self = oldGame end
  370. local wh = {...}
  371. local name = table.remove(wh,1)
  372. for i,v in next, wh do
  373. if(v == fakeGame)then v = oldGame end
  374. wh[i]=v
  375. end
  376. if serviceFunctions[name] then
  377. return GetService(self,unpack(wh))
  378. else
  379. return self(name,unpack(wh))
  380. end
  381. end
  382. getmetatable(fakeGame). __namecall=function(self,...)
  383. if(self == fakeGame)then self = oldGame end
  384. local tuple={...}
  385. local name = table.remove(tuple,#tuple)
  386.  
  387. local funcToCall=self[name]
  388.  
  389. if serviceFunctions[name] then
  390. return GetService(self,unpack(tuple))
  391. else
  392. return self[name](self,unpack(tuple))
  393. end
  394. end
  395. getmetatable(fakeGame).__metatable = 'gay'
  396.  
  397. coroutine.wrap(function()
  398. while true do
  399. Run:TrigEvent('RenderStepped')
  400. swait()
  401. end
  402. end)()
  403. game=fakeGame
  404. UserInputService,ContextActionService = UsIS,CoAS
  405. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement