Skip to content

Instantly share code, notes, and snippets.

View lucasmz-dev's full-sized avatar
👋
Probably on @signalapp

Lucas lucasmz-dev

👋
Probably on @signalapp
View GitHub Profile
@lucasmz-dev
lucasmz-dev / BackpackUtil.lua
Last active October 5, 2021 23:49
BackpackUtil
local StarterGui = game:GetService("StarterGui")
local BackpackUtil = {}
local IsBackpackHidden = false
local HiddenCounter = 0
local function ChangeBackpackVisibility(
isHidden: boolean
)
while true do
@lucasmz-dev
lucasmz-dev / SetCore.lua
Last active October 3, 2021 11:41
SetCore
local StarterGui = game:GetService("StarterGui")
local SetCore = {}
function SetCore:ChatActive(active: boolean)
StarterGui:SetCore("ChatActive", active)
end
function SetCore:BadgesNotificationsActive(active: boolean)
StarterGui:SetCore("BadgesNotificationsActive", active)
end
@lucasmz-dev
lucasmz-dev / BetterWaitForChild.lua
Last active October 21, 2021 06:41
WaitForChild but it actually uses .ChildAdded (:WaitForChild uses Stepped)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Janitor = require(ReplicatedStorage.Utils.Janitor)
return function(
parent: Instance,
childName: string
): Instance
assert(
typeof(parent) == 'Instance',
@lucasmz-dev
lucasmz-dev / FastSpawn.lua
Last active October 17, 2021 01:04
Faster Task.Spawn
local FreeThread: thread? = nil
local function RunHandlerInFreeThread(handle, ...)
local thread = FreeThread :: thread
FreeThread = nil
handle(...)
FreeThread = thread
end
@lucasmz-dev
lucasmz-dev / GoodSignal.lua
Last active December 2, 2021 00:35
GoodSignalv2
-- https://github.com/RBLXUtils/FastSignal/blob/main/src/ReplicatedStorage/FastSignal/Immediate.lua
-- FastSignal's Immediate Mode ended up being made from this code, with some modifications.
-- This gist is no longer updated and may contain bugs, check out FastSignal Immediate.
local ScriptSignal = {}
ScriptSignal.__index = ScriptSignal
local ScriptConnection = {}
ScriptConnection.__index = ScriptConnection
@lucasmz-dev
lucasmz-dev / BindToRenderStep.lua
Last active September 21, 2021 23:03
OOP BindToRenderStep
local RunService: RunService = game:GetService("RunService")
local ScriptBinding = {}
ScriptBinding.__index = ScriptBinding
local BindingId: number = 0
function ScriptBinding:Unbind()
if self._binded == false then
return
@lucasmz-dev
lucasmz-dev / Stamper.lua
Last active September 21, 2021 22:55
Stamper
--[[
Stamper.lua:
Stamper is a hyper-efficient library made for handling functions
that should run every x amount of seconds,
With multiple functions, this process can usually cause
lag, stamper fixes this, by handling it all in one connection / thread,
with custom scheduling!
]]
@lucasmz-dev
lucasmz-dev / QuickTween.lua
Last active September 21, 2021 23:03
QuickTween
local TweenService: TweenService = game:GetService("TweenService")
local FreeThread: thread? = nil
local function DestroyTween(tween: Tween)
local thread = FreeThread :: thread
FreeThread = nil
while true do
tween.Completed:Wait()
tween:Destroy()
@lucasmz-dev
lucasmz-dev / RecycledDefer.lua
Last active September 12, 2021 02:50
RecycledDefer
-- RecycledDefer is a *PROOF OF CONCEPT*.
-- It should not be used if you wanna spawn threads quickly, AFAIK that's what recycling thread with task.spawn is usually about,
-- this takes a lot longer because of table look ups, and other things.
-- So please, don't use it in an actual production.
--[[
RecycledDefer:
Library which recycles threads but with .defer, instead of using .spawn, like it usually is done.
@lucasmz-dev
lucasmz-dev / ParallelSpawn.lua
Last active September 14, 2021 23:54
ParallelSpawn
local Bindable: BindableEvent = Instance.new("BindableEvent")
type Event = typeof(Bindable.Event)
local Event: Event = Bindable.Event
return function(_function: (...any) -> (), ...)
if typeof(_function) ~= "function" then
error("Must be a function", 2)
end