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

Is the ambient being counted as nil? Nil?

Asked by 5 years ago

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

Log in to vote
2
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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)
Ad

Answer this question