Skip to content

Instantly share code, notes, and snippets.

View howmanysmall's full-sized avatar
😎
pobam L+

howmanysmall

😎
pobam L+
  • 13:01 (UTC -06:00)
View GitHub Profile
-- You should use the benchmarker to compare this one to the one you have. :P
local SpawnEvent = Instance.new("BindableEvent")
SpawnEvent.Event:Connect(function(Function, Pointer) Function(Pointer()) end)
local function FastSpawn(Function, ...)
local Length = select("#", ...)
local Arguments = {...}
SpawnEvent:Fire(Function, function() return unpack(Arguments, 1, Length) end)
end
--credit to scarious for this god module
--t1, origin CFrame
--d, distance
--s, size (vector3, center based as the middle)
--l, ignore list (array)
local Workspace = game:GetService("Workspace")
local cf =CFrame.new
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Resources = require(ReplicatedStorage:WaitForChild("Resources"))
local Color = Resources:LoadLibrary("Color")
local Tween = Resources:LoadLibrary("Tween")
local Typer = Resources:LoadLibrary("Typer")
local Enumeration = Resources:LoadLibrary("Enumeration")
local PseudoInstance = Resources:LoadLibrary("PseudoInstance")
local CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~`!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?"
local RandomLib = Random.new(os.clock() % 1 * 1E7)
local function RandomString(Length)
local String = ""
for _ = Length, 0, -1 do
local Index = RandomLib:NextInteger(1, 94)
String ..= string.sub(CHARACTERS, Index, Index)
end
local Janitor = (function()
local Instance_new = Instance.new
local LinkToInstanceIndex = newproxy(false)
local Janitors = setmetatable({}, {__mode = "k"})
local Janitor = {
__index = {CurrentlyCleaning = true};
}
------------------------------------------------------------------------
-- Freecam
-- Cinematic free camera for spectating and video production.
------------------------------------------------------------------------
local pi = math.pi
local abs = math.abs
local clamp = math.clamp
local exp = math.exp
local rad = math.rad
@howmanysmall
howmanysmall / ArrayInsertion1.lua
Created September 4, 2019 22:01
Array insertion methods.
local Functions = {}
Functions["table.insert"] = function()
local Array = {}
for Index = 1, 1E4 do
table.insert(Array, Index * 2)
end
end
Functions["#X + 1"] = function()
-- VARIABLES
local ServersHandler = {}
local ServerList = {}
-- This is O(1) vs table.remove being O(n) (I think)
local function FastRemove(Table, Index)
local Length = #Table
Table[Index] = Table[Length]
local RunService = game:GetService 'RunService'
local TextService = game:GetService 'TextService'
local Root = script.Parent.Parent
local Libraries = Root:WaitForChild 'Libraries'
local Vendor = Root:WaitForChild 'Vendor'
local UI = Root:WaitForChild 'UI'
-- Constants
local EMPTY_VECTOR2 = Vector2.new()
local Players = game:GetService("Players")
-- Load the DataStore stuff
local DEFAULT_DATA = {
Money = 0;
Inventory = {
Cat = false;
Dog = false;
Fish = true;
}