So far everything works, when the NPC is near the light it dims gradually, thanks to Nikon1j1. I can't seem to get more than one light to dim when the NPC is near, even when both lights are identical it is only working for that one light.
-- || object references || local ws = game:GetService("Workspace") -- GetService is used in this context to create a shorthand for workspace, "ws". This isn't necessarily relevant to the script, but it's something I like to do when working with workspace objects local part, npcTorso = ws.Light, ws.Demon:FindFirstChild("Torso") -- This assigns "part" to the part in Workspace, and "npcTorso" to the "Torso" part in the NPC (assuming there is one) local light = part:FindFirstChild("Light") -- The light will be referenced by the variable "Light", assuming the location of the light is "game.Workspace.Part.Light". -- || configurations || local maxBrightness = 2 -- This is the maximum brightness, where the NPC is farthest from the light local minBrightness = 0.1 -- This is the brightness that will be shown when the NPC is directly at the same position as the light. -- || numbers that change || local radius = 30 -- This is the radius in which the light will start to dim when the NPC comes near it. while wait(1/30) do local distance = (npcTorso.Position - part.Position).magnitude -- See above, this is getting the distance between the NPC and the part if distance <= radius then -- This checks if the NPC is within the radius in which the light will be affected local brightness = (distance/radius) * maxBrightness -- This calculates the brightness based on distance if (brightness < minBrightness) then -- If the brightness drops below the minimum brightness brightness = minBrightness -- Set it to the minimum brightness end light.Brightness = brightness -- Finally, set the brightness of the light end end -- Huge credit to nikon1j1 for huge help!