Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Real_functions = {
- print = print,
- tostring = tostring
- }
- local Internal_functions
- Internal_functions = {
- tostring = function(inputobject)
- if inputobject then
- typeofinputobject = typeof(inputobject)
- if typeofinputobject == "Userdata" or typeofinputobject == "Instance" then
- local vaild, name = pcall(function()
- return inputobject.Name
- end)
- if vaild then
- print(vaild,name)
- return name
- end
- elseif typeofinputobject == "Table" then
- local buffer = {"{\n"}
- for i,v in pairs(typeofinputobject) do
- buffer[#buffer+1] = "\t[" .. Internal_functions.tostring(i) .. "] = " .. Internal_functions.tostring(v) .. ",\n"
- end
- buffer[#buffer+1] = "}"
- local newstring = ""
- for i=1,#buffer do
- newstring = newstring .. buffer[i]
- end
- buffer = {}
- return newstring
- else
- return inputobject
- end
- return Real_functions["tostring"](inputobject)
- end
- return ""
- end,
- print = function(...)
- local buffer1 = {...}
- local buffer2 = {}
- for i=1,#buffer1 do
- buffer2[#buffer2+1] = Internal_functions.tostring(buffer1[i]).."\t"
- end
- local newstring = ""
- for i=1,#buffer2 do
- newstring = newstring .. buffer2[i]
- end
- buffer1 = {}
- buffer2 = {}
- rconsoleinfo(newstring)
- newstring = ""
- end,
- str_replace = function(stringin,find,replacewith)
- local replacewith = Internal_functions.tostring(replacewith)
- local string = Internal_functions.tostring(stringin)
- local find = Internal_functions.tostring(find)
- return stringin:gsub(find, replacewith)
- end
- }
- local Internal_Event = {}
- local AFHB_funcs = {}
- local AFHB_EV
- do
- local ArtificialHB = Instance.new("BindableEvent")
- ArtificialHB.Name = "ArtificialHeartbeat"
- local frame = 1 / 60
- local tf = 0
- local allowframeloss = false
- local tossremainder = false
- local lastframe = tick()
- ArtificialHB:Fire()
- local laststeptick = tick()
- Internal_Event["ArtificialHeartBeatEvent"] = game:GetService("RunService").Stepped:connect(function(s)
- local steppeddelta = tick() - laststeptick
- laststeptick = tick()
- tf = tf + steppeddelta
- if tf >= frame then
- local delta = tick() - lastframe
- if allowframeloss then
- ArtificialHB:Fire(delta)
- lastframe = tick()
- else
- for i = 1, math.floor(tf / frame) do
- local delta = tick() - lastframe
- ArtificialHB:Fire(delta)
- lastframe = tick()
- end
- lastframe = tick()
- end
- if tossremainder then
- tf = 0
- else
- tf = tf - frame * math.floor(tf / frame)
- end
- end
- end)
- ArtificialHB.Event:Connect(function()
- for i,func in pairs(AFHB_funcs) do
- if func then
- local s, error_statement = pcall(function()
- func()
- end)
- if not s then
- Internal_functions.print("[AFHB ERROR] Event Name",i,"ErrorMessage",error_statement)
- end
- end
- end
- end)
- AFHB_EV = ArtificialHB.Event
- end
- local sc
- local sc_metatable = {
- __index = function(self,key)
- local strkey = Internal_functions.tostring(key)
- if strkey then
- Internal_functions.print("[SC_METATABLE] KeyName", typeof(strkey),strkey)
- local retobject = rawget(sc,strkey)
- if not retobject and key.ClassName~="" then
- retobject = game:GetService(key.ClassName)
- end
- return retobject
- else
- Internal_functions.print("[SC_METATABLE ERROR] ToString Return null", strkey)
- end
- end,
- __call = function(self,...)
- local args = {...}
- if #args~=1 then
- return
- end
- local strkey = Internal_functions.tostring(args[1])
- if strkey then
- Internal_functions.print("[SC_METATABLE] KeyName", typeof(strkey),strkey)
- local retobject = rawget(sc,strkey)
- if not retobject and args[1] .ClassName~="" then
- retobject = game:GetService(args[1].ClassName)
- end
- return retobject
- else
- Internal_functions.print("[SC_METATABLE ERROR] ToString Return null", strkey)
- end
- end
- }
- sc = {
- ArtificialHeartBeat = AFHB_EV,
- BindToAFHB = function(self,name,func)
- AFHB_funcs[name] = func
- end,
- UnbindFromAFHB = function(self,name)
- AFHB_funcs[name] = nil
- end
- }
- return setmetatable(sc,sc_metatable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement