Trying to make a lighting system. Whenever I click a button to change the lights, i get the message: Attempt to index local 'LIGHTS' (a nil value)

My script:

local rs = game:GetService("ReplicatedStorage") local re = rs:WaitForChild("lightsRE")

re.OnServerEvent:connect(function(plr, event, LIGHTS) if event == "white" then local start = LIGHTS:WaitForChild("Light").Color local End = LIGHTS:WaitForChild("Light"):WaitForChild("white").Color

	for i = 0,1,0.1 do
		wait()
		local color = start:lerp(End,i)
		LIGHTS:WaitForChild("Light").BrickColor = BrickColor.new(color)
		LIGHTS:WaitForChild("Light"):WaitForChild("MainLight").Color = color
	end
end

end)

2 comments

0

Use code blocks.

0

please post the script that fires the server, and note that you DONT need to put player as an argument when firing the server!!!