ambience and brightness randomly going up?
so i have this script that on touch makes both lightning darkness and ambience a little darker, however after a few touches, the ambience and brightness randomly start going up instead of darker, whats the issue?
01 | local notouchagain = false |
02 | script.Parent.Touched:Connect( function (hit) |
03 | if hit.Parent.ClassName = = "Model" then |
05 | if game.Lighting.Ambient = = Color 3. new( 0 , 0 , 0 ) then |
07 | if notouchagain = = false then |
09 | local CurrentLighting = game.Lighting.Ambient |
10 | local e = Vector 3. new( 5 , 5 , 5 )/ 255 |
11 | local vectorcolour = Vector 3. new(CurrentLighting.R, CurrentLighting.G , CurrentLighting.B) |
12 | vectorcolour = vectorcolour - e |
14 | game.Lighting.Ambient = Color 3. new(vectorcolour.X,vectorcolour.Y,vectorcolour.Z) |
15 | game.Lighting.Brightness = game.Lighting.Brightness - 0.05 |
16 | script.Parent:Destroy() |