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

Lighting is white and my script for fix it doesen't work, how do i fix it?

in my game when i test it it goes all white, so i maked a script to fix the ambient to make it normal in a gui. but it doesen't work, i don't see nothing in the output about the script

local Lighty = game.Lighting.Ambient
script.Parent.MouseButton1Down:Connect(function()
	if Lighty == Color3.fromRGB(25500, 25500, 25500) then
	print("fixi")
	Lighty = Color3.fromRGB(255,255,255)
	end
end)

3 answers

You have the fromRGB values incorrect, the maximum RGB values are 255 and 0 as the minimum. Try this and see if it works

local Lighty = game.Lighting.Ambient script.Parent.MouseButton1Down:Connect(function() if Lighty == Color3.fromRGB(255, 255, 255) then print("fixi") Lighty = Color3.fromRGB(255,255,255) end end) 

3 comments

0

you messed up OP's indentation lol. and the numbers will automatically be reduced to 255 if over the limit, neither did you fix the problem. 

0

but my ambient in-game is 25500,25500,25500

0

it gets reduced

###The problem lies in the fact that you wrongly assume that the Lighty variable is a reference to the actual property of Lighting. If the ambient of Lighting changes, the variables you have defined won't update; only its Ambient property will change. In order to fix this, you can remove the Lighty variable and only make direct accesses to the Ambient property of Lighting. You could also modify the variables to hold Lighting itself.

local Lighting = game:GetService("Lighting")

script.Parent.Activated:Connect(function(inputObject
    if Lighting.Ambient == Color3.fromRGB(255, 255, 255) then
        print("fixi")
        Lighting.Ambient = Color3.fromRGB(255,255,255)
    end
end)


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