Skip to content

Instantly share code, notes, and snippets.

View ryanlua's full-sized avatar

Ryan Luu ryanlua

View GitHub Profile
@ryanlua
ryanlua / ShadowOptimize.luau
Last active January 31, 2025 09:21
Disables shadows for small parts to improve performance
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local minSize = Vector3.new(5, 5, 5)
local recording = ChangeHistoryService:TryBeginRecording("Disable CastShadow")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("MeshPart") or descendant:IsA("Part") or descendant:IsA("UnionOperation") then
if descendant.Size.X < minSize.X and descendant.Size.Y < minSize.Y and descendant.Size.Z < minSize.Z then
descendant.CastShadow = false
@ryanlua
ryanlua / WorkspaceOptimize.lua
Created September 5, 2023 07:05
Optimizes performance by setting Workspace properties
workspace.ClientAnimatorThrottling = Enum.ClientAnimatorThrottlingMode.Enabled
workspace.InterpolationThrottling = Enum.InterpolationThrottlingMode.Enabled
workspace.Retargeting = Enum.AnimatorRetargetingMode.Enabled
@ryanlua
ryanlua / CollisionOptimize.lua
Last active April 16, 2024 02:30
Removes all CanTouch and CanQuery collision events for better performance
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local recording = ChangeHistoryService:TryBeginRecording("Disable CanTouch and CanQuery on BaseParts")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("BasePart") then
descendant.CanTouch = false
descendant.CanQuery = false
end
end
@ryanlua
ryanlua / RenderFidelityOptimize.lua
Last active April 16, 2024 02:29
Optimizes the appearance of Meshes and Unions by setting RenderFidelity
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local recording = ChangeHistoryService:TryBeginRecording("Change RenderFidelity to Performance/Automatic")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("MeshPart") then
descendant.RenderFidelity = Enum.RenderFidelity.Performance
elseif descendant:IsA("UnionOperation") then
descendant.RenderFidelity = Enum.RenderFidelity.Automatic
end