Skip to content

Instantly share code, notes, and snippets.

@ryanlua
Last active January 31, 2025 09:21
Show Gist options
  • Select an option

  • Save ryanlua/405db1aebe72ddfeaee41b76f39de190 to your computer and use it in GitHub Desktop.

Select an option

Save ryanlua/405db1aebe72ddfeaee41b76f39de190 to your computer and use it in GitHub Desktop.
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
end
end
end
ChangeHistoryService:FinishRecording(recording, Enum.FinishRecordingOperation.Commit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment