Attempt to index number with 'Brightness'

Whenever I try to edit a PointLight’s Brightness to the value of a leaderstat, it returns
attempt to index number with 'Brightness'
Both leaderstats are NumberValues which are assigned as 0 before the script is run
Code:

local light = script.Parent.Light.PointLight
local tool = script.Parent
local activated = true
local plr
local light
local rebirths

tool.Activated:Connect(function()
	if activated == true then
		activated = false
		plr = game:GetService("Players"):GetPlayerFromCharacter(tool:FindFirstAncestorWhichIsA("Model"))
		print(plr.Name)
		light = plr:FindFirstChild("leaderstats"):FindFirstChild("Light").Value
		print(light)
		rebirths = plr:FindFirstChild("leaderstats"):FindFirstChild("Rebirths").Value
		print(rebirths)
		light = light + (1*((rebirths*3)+1))
		print(light)
		light.Brightness = light
		light.Brightness = (light/5)
		task.wait(1)
		activated = true
	end
end)

Console:

  Ethanlovir  -  Server - Script:12
  0  -  Server - Script:14
  0  -  Server - Script:16
  1  -  Server - Script:18
  Players.Ethanlovir.Backpack.Lightbulb.Script:19: attempt to index number with 'Brightness'  -  Server - Script:19

All the debug prints seem to be correct, so I don’t know what’s wrong

You are using the light variable to try and represent a number, but also trying to use it like its a variable to a light instance.

make sure your light instance and light value are not using the same named variable.
image
image

I’m too tired, I don’t know why I didn’t notice lol. Thank you!

XD It happens, tbh, I did the same thing just last week in my own code :stuck_out_tongue: