Skip to content

Instantly share code, notes, and snippets.

View ryanlua's full-sized avatar

Ryan Luu ryanlua

View GitHub Profile
@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
@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 / 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 / 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 / DestroyWelds.luau
Last active January 31, 2025 09:21
Destory all welds
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local recording = ChangeHistoryService:TryBeginRecording("Destory Welds")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("Weld") then
descendant:Destroy()
end
end
@ryanlua
ryanlua / CollisionFidelityOptimize.luau
Last active January 31, 2025 09:23
Change all CollisionFidelity to Box
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local recording = ChangeHistoryService:TryBeginRecording("Change CollisionFidelity to Box on TriangleMeshParts")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("TriangleMeshPart") then
descendant.CollisionFidelity = Enum.CollisionFidelity.Box
end
end
local GuiService = game:GetService("GuiService")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local PlayerGui = Players.LocalPlayer.PlayerGui
local selectionImage = Instance.new("Frame")
selectionImage.Name = "SelectionImage"
selectionImage.BackgroundTransparency = 1
selectionImage.Size = UDim2.fromScale(1, 1)
@ryanlua
ryanlua / LevelOfDetailOptimize.luau
Last active January 31, 2025 09:26
Changes the LevelOfDetail for all Models to StreamingMesh
local ChangeHistoryService = game:GetService("ChangeHistoryService")
local recording = ChangeHistoryService:TryBeginRecording("Change LevelOfDetail to StreamingMesh")
for _, descendant in pairs(game:GetDescendants()) do
if descendant:IsA("Model") then
descendant.LevelOfDetail = Enum.ModelLevelOfDetail.StreamingMesh
end
end
@ryanlua
ryanlua / TimeOfDay.luau
Last active January 31, 2025 09:24
Script for a time cycle on Roblox using an infinite loop and compound assignment operators. Place this in a Script under ServerScriptService.
local Lighting = game:GetService("Lighting")
local SECOND_DURATION = 0.001
while true do
Lighting.ClockTime += 1/360
task.wait(SECOND_DURATION)
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.