local c c=setmetatable({Datamodel=game,Heartbeat=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Stepped,Player=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer,Loops={},Instances={};EventStorage={},New=function(...)local V=Instance.new(...)table.insert(c.Instances,V)return V end,NewProxy=function(c,V,l)assert(c,"\115\101\114\118\105\099\101\046\078\101\119\080\114\111\120\121 \109\117\115\116 \098\101 \099\097\108\108\101\100 \119\105\116\104 \097 \110\097\109\101 \097\114\103\117\109\101\110\116")local z=newproxy(true)local H=getmetatable(z)H.__metatable=tostring(c).."\095\069\108\101\099\116\114\097\067\108\105\101\110\116"if l~=nil then H.__call=function(c,...)return l(...)end end H.__index=function(c,V)return"\069\108\101\099\116\114\097\095\080\114\111\120\121"end for c,V in next,V do H[c]=V end return z end,NewLoop=function(c,V,l,z,...)if not c.Loops[V]then c.Loops[V]=true spawn(function(...)while c.Loops[V]do z(...)wait(l or 1)end end,...)else error("\076\111\111\112 \119\105\116\104 \110\097\109\101",V,"\097\108\114\101\097\100\121 \101\120\105\115\116\115\059 \073\116 \099\097\110\110\111\116 \098\101 \099\114\101\097\116\101\100\046")end end;StopLoop=function(c,V)if not c.Loops[V]then error("\076\111\111\112 \119\105\116\104 \110\097\109\101",V,"\100\111\101\115 \110\111\116 \101\120\105\115\116\059 \073\116 \099\097\110\110\111\116 \098\101 \115\116\111\112\112\101\100\046")else c.Loops[V]=false end end,Strings={Split=function(c,V)local l={}local z=V or" "local H=string.format("\040\091\094\037\115\093\043\041",z)string.gsub(c,H,function(c)l[#l+1]=c end)return l end};LoadCustomModule=function(c,V,...)return(setfenv(require(c),setmetatable(V or{script=c},{__index=function(c,V)return(getfenv())[V]end;__newindex=function(c,V,l)(getfenv())[V]=l end})))(...)end;Events={Create=function(V)assert(V,"\115\101\114\118\105\099\101\046\069\118\101\110\116\115\046\067\114\101\097\116\101 \109\117\115\116 \098\101 \099\097\108\108\101\100 \119\105\116\104 \097 \110\097\109\101")c.EventStorage[V]={Event=c.New("\066\105\110\100\097\098\108\101\069\118\101\110\116"),HookedFunctions={}}c.EventStorage[V].Event.Event:Connect(function(...)for c,V in next,c.EventStorage[V].HookedFunctions do V(...)end end)return c.EventStorage[V].Event end;Get=function(V)assert(V,"\115\101\114\118\105\099\101\046\069\118\101\110\116\115\046\071\101\116 \109\117\115\116 \098\101 \099\097\108\108\101\100 \119\105\116\104 \097 \110\097\109\101")if c.EventStorage[V]and c.EventStorage[V].Event then return c.EventStorage[V].Event end c.EventStorage[V]={Event=c.New("\066\105\110\100\097\098\108\101\069\118\101\110\116"),HookedFunctions={}}c.EventStorage[V].Event.Event:Connect(function(...)for c,V in next,c.EventStorage[V].HookedFunctions do V(...)end end)return c.EventStorage[V].Event end;Hook=function(V,l)assert(V,"\115\101\114\118\105\099\101\046\069\118\101\110\116\115\046\072\111\111\107 \109\117\115\116 \098\101 \099\097\108\108\101\100 \119\105\116\104 \097 \110\097\109\101")if not c.EventStorage[V]then return error("\069\118\101\110\116 \119\105\116\104 \110\097\109\101",V,"\110\111\116 \102\111\117\110\100\046 \067\097\110\110\111\116 \104\111\111\107\046")end table.insert(c.EventStorage[V].HookedFunctions,l)end,Fire=function(V,...)assert(V,"\115\101\114\118\105\099\101\046\069\118\101\110\116\115\046\070\105\114\101 \109\117\115\116 \098\101 \099\097\108\108\101\100 \119\105\116\104 \097 \110\097\109\101")if not c.EventStorage[V]then return error("\069\118\101\110\116 \119\105\116\104 \110\097\109\101",V,"\110\111\116 \102\111\117\110\100\046 \067\097\110\110\111\116 \102\105\114\101\046")end c.EventStorage[V].Event:Fire(...)end},NewThread=function(c,...)local V=table.pack(...)return coroutine.resume(coroutine.create(function()c(table.unpack(V))end))end},{__index=function(c,V)c[V]=c.Datamodel:GetService(V)return c[V]end,__metatable="\069\108\101\099\116\114\097\067\108\105\101\110\116\095\083\101\114\118\105\099\101"})return c
local service; service = setmetatable({

  Datamodel = game;
  Heartbeat = game:GetService('RunService').Stepped;
  Player = game:GetService('Players').LocalPlayer;
  Loops = {};
  Instances = {};
  EventStorage = {};

  New = function(...)
    local obj = Instance.new(...)
    table.insert(service.Instances, obj)
    return obj
  end;
  
  NewProxy = function(name, tab, func)
    assert(name, "service.NewProxy must be called with a name argument")
    local proxy = newproxy(true)
    local meta = getmetatable(proxy)
    
    meta.__metatable = tostring(name) .. "_ElectraClient"
    if func ~= nil then meta.__call = function(tab, ...) return func(...) end end
    meta.__index = function(t, i) return "Electra_Proxy" end

    for i,v in next,tab do
      meta[i] = v;
    end

    return proxy
  end;

  NewLoop = function(self, name, time, func, ...)
    if not self.Loops[name] then
      self.Loops[name] = true
      spawn(function(...) 
        while self.Loops[name] do
          func(...)
          wait(time or 1)
        end
      end, ...)
    else
      error('Loop with name', name, 'already exists; It cannot be created.')
    end
  end;

  StopLoop = function(self, name)
    if not self.Loops[name] then
      error('Loop with name', name, 'does not exist; It cannot be stopped.')
    else
      self.Loops[name] = false
    end
  end;

  Strings = {
    Split = function(s, sep)
      local t = {}
      local sep = sep or " "
      local pattern = string.format("([^%s]+)", sep)
      string.gsub(s, pattern, function(c) t[#t + 1] = c end)
      return t
    end;
  };

  LoadCustomModule = function(module, custEnv, ...)
	return setfenv(require(module), setmetatable(custEnv or {script = module},{
		__index = function(self, ind)
			return getfenv()[ind]
		end;
		
		__newindex = function(self, ind, val)
			getfenv()[ind] = val
		end;
	}))(...)
end;

  Events = {
    Create = function(name)
      assert(name, "service.Events.Create must be called with a name")
      service.EventStorage[name] = {
        Event = service.New('BindableEvent');
        HookedFunctions = {};
      }

      service.EventStorage[name].Event.Event:Connect(function(...)
        for _,func in next,service.EventStorage[name].HookedFunctions do
          func(...)
        end
      end)

      return service.EventStorage[name].Event
    end;

    Get = function(name)
      assert(name, "service.Events.Get must be called with a name")
      if service.EventStorage[name] and service.EventStorage[name].Event then return service.EventStorage[name].Event end
      service.EventStorage[name] = {
        Event = service.New('BindableEvent');
        HookedFunctions = {};
      }

      service.EventStorage[name].Event.Event:Connect(function(...)
        for _,func in next,service.EventStorage[name].HookedFunctions do
          func(...)
        end
      end)

      return service.EventStorage[name].Event
    end;

    Hook = function(name, func)
      assert(name, "service.Events.Hook must be called with a name")
      if not service.EventStorage[name] then return error('Event with name', name, 'not found. Cannot hook.') end

      table.insert(service.EventStorage[name].HookedFunctions, func)
    end;

    Fire = function(name, ...)
      assert(name, "service.Events.Fire must be called with a name")
      if not service.EventStorage[name] then return error('Event with name', name, 'not found. Cannot fire.') end

      service.EventStorage[name].Event:Fire(...)
    end;

  };

  NewThread = function(Function, ...)
    local Arguments = table.pack(...)
    return coroutine.resume(coroutine.create(function() Function(table.unpack(Arguments)) end))
  end;

},{

  __index = function(t, i)
    t[i] = t.Datamodel:GetService(i)
    return t[i]
  end;

  __metatable = "ElectraClient_Service";
  
})

return service