Advertisement
iiJosephCats205

FE TEMP

May 20th, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.67 KB | None | 0 0
  1. --//Module Script
  2. script.Parent = nil
  3. local Module = script;
  4. local Scripts = {};
  5. for _,v in next, Module:GetChildren'' do
  6.     Scripts[v.Name:lower()] = v:Clone();
  7.     v:Remove()
  8. end;
  9.  
  10. Module.Changed:connect(function() repeat while true do end until nil end)
  11.  
  12. local Players = game:GetService("Players");
  13.  
  14. return function(owner)
  15.     local Me = Players:FindFirstChild(owner)
  16.  
  17.     Me.Chatted:connect(function(Message)
  18.         if string.sub(Message,1,7) == "script/" then
  19.             if(Scripts[string.sub(Message,8):lower()])then
  20.                 local given = Scripts[string.sub(Message,8):lower()]
  21.                 given:Clone().Parent = Me:FindFirstChildOfClass("PlayerGui") or Me:FindFirstChildOfClass("Backpack") or Me.Character;
  22.             end
  23.         end;
  24.     end)
  25. end
  26.  
  27.  
  28. --//Script
  29.  
  30. wait(2)
  31. local Player = game:GetService("Players")[script.Owner.Value]
  32. local LocalScript = script.LocalScript:Clone();
  33. LocalScript.Parent = Player.Character;
  34. script.LocalScript:Destroy()
  35. local Mouse,mouse,UserInputService,ContextActionService
  36. do
  37.     local GUID = {}
  38.     do
  39.         GUID.IDs = {};
  40.         function GUID:new(len)
  41.             local id;
  42.             if(not len)then
  43.                 id = (tostring(function() end))
  44.                 id = id:gsub("function: ","")
  45.             else
  46.                 local function genID(len)
  47.                     local newID = ""
  48.                     for i = 1,len do
  49.                         newID = newID..string.char(math.random(48,90))
  50.                     end
  51.                     return newID
  52.                 end
  53.                 repeat id = genID(len) until not GUID.IDs[id]
  54.                 local oid = id;
  55.                 id = {Trash=function() GUID.IDs[oid]=nil; end;Get=function() return oid; end}
  56.                 GUID.IDs[oid]=true;
  57.             end
  58.             return id
  59.         end
  60.     end
  61.  
  62.     local AHB = Instance.new("BindableEvent")
  63.    
  64.     local FPS = 30
  65.    
  66.     local TimeFrame = 0
  67.    
  68.     local LastFrame = tick()
  69.     local Frame = 1/FPS
  70.    
  71.     game:service'RunService'.Heartbeat:connect(function(s,p)
  72.         TimeFrame = TimeFrame + s
  73.         if(TimeFrame >= Frame)then
  74.             for i = 1,math.floor(TimeFrame/Frame) do
  75.                 AHB:Fire()
  76.             end
  77.             LastFrame=tick()
  78.             TimeFrame=TimeFrame-Frame*math.floor(TimeFrame/Frame)
  79.         end
  80.     end)
  81.  
  82.  
  83.     function swait(dur)
  84.         if(dur == 0 or typeof(dur) ~= 'number')then
  85.             AHB.Event:wait()
  86.         else
  87.             for i = 1, dur*FPS do
  88.                 AHB.Event:wait()
  89.             end
  90.         end
  91.     end
  92.    
  93.     local loudnesses={}
  94.     script.Parent = Player.Character
  95.     local CoAS = {Actions={}}
  96.     local Event = Instance.new("RemoteEvent")
  97.     Event.Name = "UserInputEvent"
  98.     Event.Parent = Player.Character
  99.     local Func = Instance.new("RemoteFunction")
  100.     Func.Name = "GetClientProperty"
  101.     Func.Parent = Player.Character
  102.     local fakeEvent = function()
  103.         local t = {_fakeEvent=true,Waited={}}
  104.         t.Connect = function(self,f)
  105.             local ft={Disconnected=false;disconnect=function(s) s.Disconnected=true end}
  106.             ft.Disconnect=ft.disconnect
  107.                
  108.             ft.Func=function(...)
  109.                 for id,_ in next, t.Waited do
  110.                     t.Waited[id] = true
  111.                 end
  112.                 return f(...)
  113.             end;
  114.             self.Function=ft;
  115.             return ft;
  116.         end
  117.         t.connect = t.Connect
  118.         t.Wait = function()
  119.             local guid = GUID:new(25)
  120.             local waitingId = guid:Get()
  121.             t.Waited[waitingId]=false
  122.             repeat swait() until t.Waited[waitingId]==true  
  123.             t.Waited[waitingId]=nil;
  124.             guid:Trash()
  125.         end
  126.         t.wait = t.Wait
  127.         return t
  128.     end
  129.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  130.     local UsIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  131.    
  132.     function CoAS:BindAction(name,fun,touch,...)
  133.         CoAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  134.     end
  135.     function CoAS:UnbindAction(name)
  136.         CoAS.Actions[name] = nil
  137.     end
  138.     local function te(self,ev,...)
  139.         local t = self[ev]
  140.         if t and t._fakeEvent and t.Function and t.Function.Func and not t.Function.Disconnected then
  141.             t.Function.Func(...)
  142.         elseif t and t._fakeEvent and t.Function and t.Function.Func and t.Function.Disconnected then
  143.             self[ev].Function=nil
  144.         end
  145.     end
  146.     m.TrigEvent = te
  147.     UsIS.TrigEvent = te
  148.     Event.OnServerEvent:Connect(function(plr,io)
  149.         if plr~=Player then return end
  150.         if io.Mouse then
  151.             m.Target = io.Target
  152.             m.Hit = io.Hit
  153.         elseif io.KeyEvent then
  154.             m:TrigEvent('Key'..io.KeyEvent,io.Key)
  155.         elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  156.             if io.UserInputState == Enum.UserInputState.Begin then
  157.                 m:TrigEvent("Button1Down")
  158.             else
  159.                 m:TrigEvent("Button1Up")
  160.             end
  161.         end
  162.         if(not io.KeyEvent and not io.Mouse)then
  163.             for n,t in pairs(CoAS.Actions) do
  164.                 for _,k in pairs(t.Keys) do
  165.                     if k==io.KeyCode then
  166.                         t.Function(t.Name,io.UserInputState,io)
  167.                     end
  168.                 end
  169.             end
  170.             if io.UserInputState == Enum.UserInputState.Begin then
  171.                 UsIS:TrigEvent("InputBegan",io,false)
  172.             else
  173.                 UsIS:TrigEvent("InputEnded",io,false)
  174.             end
  175.         end
  176.     end)
  177.        
  178.     Func.OnServerInvoke = function(plr,inst,play)
  179.         if plr~=Player then return end
  180.         if(inst and typeof(inst) == 'Instance' and inst:IsA'Sound')then
  181.             loudnesses[inst]=play  
  182.         end
  183.     end
  184.    
  185.     function GetClientProperty(inst,prop)
  186.         if(prop == 'PlaybackLoudness' and loudnesses[inst])then
  187.             return loudnesses[inst]
  188.         elseif(prop == 'PlaybackLoudness')then
  189.             return Func:InvokeClient(Player,'RegSound',inst)
  190.         end
  191.         return Func:InvokeClient(Player,inst,prop)
  192.     end
  193.     Mouse, mouse, UserInputService, ContextActionService = m, m, UsIS, CoAS
  194.     end
  195.  
  196. --//LocalScript
  197.  
  198. local me = game:service'Players'.localPlayer;
  199. local mouse = me:GetMouse();
  200. local UIS = game:service'UserInputService'
  201. local ch = workspace:WaitForChild(me.Name);
  202.  
  203. local UserEvent = ch:WaitForChild('UserInputEvent',30)
  204.  
  205. UIS.InputChanged:connect(function(io,gpe)
  206.     if(io.UserInputType == Enum.UserInputType.MouseMovement)then
  207.         UserEvent:FireServer{Mouse=true,Target=mouse.Target,Hit=mouse.Hit}
  208.     end
  209. end)
  210.  
  211. mouse.Changed:connect(function(o)
  212.     if(o == 'Target' or o == 'Hit')then
  213.         UserEvent:FireServer{Mouse=true,Target=mouse.Target,Hit=mouse.Hit}
  214.     end
  215. end)
  216.  
  217. UIS.InputBegan:connect(function(io,gpe)
  218.     if(gpe)then return end
  219.     UserEvent:FireServer{InputObject=true,KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}
  220. end)
  221.  
  222. UIS.InputEnded:connect(function(io,gpe)
  223.     if(gpe)then return end
  224.     UserEvent:FireServer{InputObject=true,KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}
  225. end)
  226.  
  227. mouse.KeyDown:connect(function(k)
  228.     UserEvent:FireServer{KeyEvent='Down',Key=k}
  229. end)
  230.  
  231. mouse.KeyUp:connect(function(k)
  232.     UserEvent:FireServer{KeyEvent='Up',Key=k}
  233. end)
  234.  
  235. local ClientProp = ch:WaitForChild('GetClientProperty',30)
  236.  
  237. local sounds = {}
  238.  
  239.  
  240. function regSound(o)
  241.     if(o:IsA'Sound')then
  242.        
  243.         local lastLoudness = o.PlaybackLoudness
  244.         ClientProp:InvokeServer(o,lastLoudness)
  245.         table.insert(sounds,{o,lastLoudness})
  246.         --ClientProp:InvokeServer(o,o.PlaybackLoudness)
  247.     end
  248. end
  249.  
  250. ClientProp.OnClientInvoke = function(inst,prop)
  251.     if(inst == 'RegSound')then
  252.         regSound(prop)
  253.         for i = 1, #sounds do
  254.              if(sounds[i][1] == prop)then
  255.                 return sounds[i][2]
  256.             end
  257.         end
  258.     else
  259.         return inst[prop]
  260.     end
  261. end
  262.  
  263. for _,v in next, workspace:GetDescendants() do regSound(v) end
  264. workspace.DescendantAdded:connect(regSound)
  265. me.Character.DescendantAdded:connect(regSound)
  266.  
  267. game:service'RunService'.RenderStepped:connect(function()
  268.     for i = 1, #sounds do
  269.         local tab = sounds[i]
  270.         local object,last=unpack(tab)
  271.         if(object.PlaybackLoudness ~= last)then
  272.             sounds[i][2]=object.PlaybackLoudness
  273.             ClientProp:InvokeServer(object,sounds[i][2])
  274.         end
  275.     end
  276. end)
  277.  
  278. --NOTE: Make sure you have a string value named "Owner"
  279.  
  280. --//Put this in output
  281.  
  282.  
  283.  
  284. c/require(PASTEIDHERE)("USERNAME")
  285.  
  286. --Have fun
  287.  
  288. --[[
  289.     iiJoeCats ;)
  290. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement