can you optimize this roblox lua script for better performance?

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local function CreateNameTag(Player)
    if Player.Character and not Player.Character:FindFirstChild("NameTag") then
        -- local billboardGui = Instance.new("BillboardGui", Player.Character)
        -- billboardGui.Name = "NameTag"
        -- billboardGui.Size = UDim2.new(0, 100, 0, 50)
        -- billboardGui.StudsOffset = Vector3.new(0, 2, 0)
        -- billboardGui.Adornee = Player.Character:FindFirstChild("Head") or Player.Character:FindFirstChildWhichIsA("BasePart")
        -- billboardGui.AlwaysOnTop = true
        if Player.Character ~= nil and Player.Character:FindFirstChild("Humanoid") ~= nil and Player.Character:FindFirstChild("HumanoidRootPart") ~= nil and Player.Character.Humanoid.Health > 0 and Player.Character:FindFirstChild("Head") ~= nil
        then
            local Target2dPosition, IsVisible = workspace.CurrentCamera:WorldToViewportPoint(Player.Character.HumanoidRootPart.Position)
            local scale_factor = 1 / (Target2dPosition.Z * math.tan(math.rad(workspace.CurrentCamera.FieldOfView * 0.5)) * 2) * 100
            local width, height = math.floor(40 * scale_factor), math.floor(60 * scale_factor)
            
            local textLabel = Drawing.new("Text")
            textLabel.Visible = IsVisible
            textLabel.Size = 13
            textLabel.Text = Player.Name.." "..math.floor((workspace.CurrentCamera.CFrame.p - Player.Character.HumanoidRootPart.Position).magnitude).."m"
            textLabel.Position = Vector2.new(Target2dPosition.X, Target2dPosition.Y - height * 0.5 + -15)
            textLabel.Center = true
            textLabel.Color = Color3.fromRGB(255, 255, 255) -- White color for the text
            textLabel.Outline = false
            textLabel.OutlineColor = Color3.fromRGB(0, 0, 0)
            textLabel.Font = 2
    end
end

local function CreateHighlight(Player)
    if Player ~= Players.LocalPlayer and Player.Character and not Player.Character:FindFirstChild("Highlight") then
        Instance.new("Highlight", Player.Character)
        CreateNameTag(Player) -- Add this line to create the name tag
    end
end

local function UpdateHighlight(Player, HighlightColor)
    if Player ~= Players.LocalPlayer and Player.Character and Player.Character:FindFirstChild("Highlight") then
        Player.Character.Highlight.FillColor = HighlightColor
    end
end

local function ApplyChams()
    local LocalPlayer = Players.LocalPlayer
    local roles = ReplicatedStorage:FindFirstChild("GetPlayerData", true):InvokeServer()

    local Murderer, Sheriff, Hero

    for i, v in pairs(roles) do
        if v.Role == "Murderer" then
            Murderer = i
        elseif v.Role == 'Sheriff' then
            Sheriff = i
        elseif v.Role == 'Hero' then
            Hero = i
        end
    end

    for _, Player in pairs(Players:GetPlayers()) do
        CreateHighlight(Player)
        
        if Player.Name == Sheriff then
            UpdateHighlight(Player, Color3.fromRGB(0, 0, 255)) -- Blue for Sheriff
        elseif Player.Backpack:FindFirstChild("Gun") or (Player.Character and Player.Character:FindFirstChild("Gun")) then
            UpdateHighlight(Player, Color3.fromRGB(0, 0, 255)) -- Blue for players with Gun
        elseif Player.Name == Murderer then
            UpdateHighlight(Player, Color3.fromRGB(255, 0, 0)) -- Red for Murderer
        elseif Player.Name == Hero and not roles[Sheriff].Killed and not roles[Sheriff].Dead then
            UpdateHighlight(Player, Color3.fromRGB(255, 250, 0)) -- Yellow for Hero if Sheriff is dead
        else
            UpdateHighlight(Player, Color3.fromRGB(0, 255, 0)) -- Green for Innocent
        end
    end
end

for _, v in pairs(Players:GetPlayers()) do
    if v ~= Players.LocalPlayer then
        CreateHighlight(v)
        v.CharacterAdded:Connect(function()
            CreateHighlight(v)
        end)
    end
end

Players.PlayerAdded:Connect(function(v)
    if v ~= Players.LocalPlayer then
        CreateHighlight(v)
        v.CharacterAdded:Connect(function()
            CreateHighlight(v)
        end)
    end
end)

-- Gun Drop ESP
RunService.RenderStepped:Connect(function()
    if workspace:FindFirstChild("GunDrop") then
        if not workspace.GunDrop:FindFirstChild("MM2MDG") then
            local hl = Instance.new("Highlight")
            hl.Parent = workspace.GunDrop
            hl.FillTransparency = 0
            hl.OutlineTransparency = 0
            hl.OutlineColor = Color3.fromRGB(0, 255, 0)
            hl.FillColor = Color3.fromRGB(255, 180, 29)
            hl.Name = "MM2MDG"
        end
    end
end)

while true do
    ApplyChams()
    wait(1) -- Update chams every second
end