Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
1
Answered by 6 years ago

Nvm i got it

0
you should let people know by accepting an answer. User#19524 175 — 6y
0
i got another solution TheEdyGamerTroll23 15 — 6y
Ad
Log in to vote
0
Answered by
Troxure 87
6 years ago

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) 

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.  User#19524 175 — 6y
0
but my ambient in-game is 25500,25500,25500 TheEdyGamerTroll23 15 — 6y
0
it gets reduced User#19524 175 — 6y
Log in to vote
0
Answered by 6 years ago

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)


Answer this question