Coding
for _, Value in pairs(game.Workspace:GetChildren()) do
Is the same as:
for _, Value in (game.Workspace:GetChildren()) do
(This does not apply to ipairs, only use this for pairs.)
if Thing then
if not Thing then
Is the same as:
if Thing == true then
if Thing == false then
This also applies to stuff like " and ', you can also do .5 instead of 0.5 when typing out numbers.
You should be localizing variables and functions when possible.
local Thing = true
local ReplicatedStorage = game.ReplicatedStorage
local Players = game:GetService("Players")
local function DoThing()
(Luau localizes variables by default internally, but typing them out by hand is still slightly faster.)
Use functions provided by Roblox when possible.
For example:
for _,Player in ipairs(Players:GetPlayers()) do
local Distance = Player:DistanceFromCharacter(Part.Position)
ParticleEmitter:Emit(50)
Although stuff like
Humanoid:TakeDamage(10)
is slightly slower than
Humanoid.Health -= 10
because Humanoid:TakeDamage() has extra checks (For example if the player has a forcefield active), so take this into consideration.