Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is the ambient being counted as nil? Nil?

I am trying to have the lighting changed locally for each player, FogEnd is working fine but when I test the game the Ambient goes to 51000, 51000, 51000. What am I doing wrong? (Note: the value of Ambient is 200)

Lightining = game.Lighting
Ambient = Lightining.Ambient
FogEnd = Lightining.FogEnd
ReplicatedStorage = game.ReplicatedStorage
LightingFolder = ReplicatedStorage.Lighting
while true do
	wait()
	while game.ReplicatedStorage.StateTag.Value == 'Start' and game.Players.LocalPlayer.Character:FindFirstChild('MatchTag') do
		wait()
		game.Lighting.Ambient = Color3.new(script.Ambient.Value,script.Ambient.Value,script.Ambient.Value)
		game.Lighting.FogEnd = script.FogEnd.Value
	end
	game.Lighting.Ambient = Color3.new(150,150,150)
	game.Lighting.FogEnd = 1000
end

1 answer

Because Color3.new accepts numbers between 0 - 1, either use Color3.fromRGB or divide the components by 255.

Doing Color3.new(150, 150, 150) will multiply each component by 255, which will give a big number

game.Lighting.Ambient = Color3.fromRGB(150, 150, 150)

-- or

game.Lighting.Ambient = Color3.new(150/255, 150/255, 150/255)

This discussion is preserved as it was. New answers, comments, and votes are closed.