Fog and Ambient doesn't reset to normal?
Asked by
4 years ago Edited 4 years ago
I was coding something for some guy. He doesn't know how to script, so I decided to give him my services. However, with this generator model, I put the broken version in ReplicatedStorage and the fixed version in Workspace. it worked, until I put fog and ambience configs and settings in. Code here.
Fix code
01 | local ClickDetector = script.Parent.ClickDetector |
03 | local printText = "Remote event fired successfully!" |
05 | local brokenAmbient = "0,0,0" |
06 | local brokenFogEnd = 350 |
07 | local brokenBrightness = 0 |
08 | local fixedAmbient = "255,255,255" |
09 | local fixedBrightness = 1 |
10 | local fixedFogEnd = 750 |
13 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
14 | local GeneratorFolder = game:GetService( "Workspace" ).Generators |
17 | local Fixed = GeneratorFolder:WaitForChild( "Fixed" ) |
18 | local Broken = ReplicatedStorage:WaitForChild( "Broken" ) |
20 | local LeverSound = script.Parent:WaitForChild( "LeverPulled" ) |
21 | local SoundBroken = script.Parent:WaitForChild( "PowerFailure" ) |
22 | local SoundFixed = script.Parent:WaitForChild( "PowerFixed" ) |
23 | local SoundDeny = script.Parent:WaitForChild( "AccessDenied" ) |
25 | local MetalHolder = script.Parent.Parent [ "Metal thing" ] |
26 | local Circle = script.Parent.Parent [ "Circle thing" ] |
28 | local RemoteEvent = game.ReplicatedStorage:WaitForChild( "450GKDGKC" ) |
30 | local TeamColorBreak = "Institutional white" |
33 | if plr and plr.TeamColor = = BrickColor.new(TeamColorBreak) then |
34 | RemoteEvent:FireAllClients() |
40 | game.Lighting.FogEnd = fixedFogEnd |
41 | game.Lighting.Brightness = fixedBrightness |
42 | game.Lighting.Ambient = Color 3. fromRGB(fixedAmbient) |
43 | RemoteEvent:FireAllClients() |
48 | Fixed.Parent = GeneratorFolder |
49 | Broken.Parent = ReplicatedStorage |
50 | ClickDetector.MaxActivationDistance = 0 |
51 | script.Parent.Parent.Parent.Lever.Hitbox.ClickDetector.MaxActivationDistance = 4 |
54 | ClickDetector.MouseClick:Connect(onClick) |
Broken:
01 | local ClickDetector = script.Parent.ClickDetector |
03 | local printText = "Remote event fired successfully!" |
05 | local brokenAmbient = "0,0,0" |
06 | local brokenFogEnd = 350 |
07 | local brokenBrightness = 0 |
08 | local fixedAmbient = "255,255,255" |
09 | local fixedBrightness = 1 |
10 | local fixedFogEnd = 750 |
13 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
14 | local GeneratorFolder = game:GetService( "Workspace" ).Generators |
17 | local Fixed = GeneratorFolder:WaitForChild( "Fixed" ) |
18 | local Broken = ReplicatedStorage:WaitForChild( "Broken" ) |
20 | local LeverSound = script.Parent:WaitForChild( "LeverPulled" ) |
21 | local SoundBroken = script.Parent:WaitForChild( "PowerFailure" ) |
22 | local SoundFixed = script.Parent:WaitForChild( "PowerFixed" ) |
23 | local SoundDeny = script.Parent:WaitForChild( "AccessDenied" ) |
25 | local MetalHolder = script.Parent.Parent [ "Metal thing" ] |
26 | local Circle = script.Parent.Parent [ "Circle thing" ] |
28 | local RemoteEvent = game.ReplicatedStorage:WaitForChild( "450GKDGKC" ) |
30 | local TeamColorBreak = "Institutional white" |
33 | if plr and plr.TeamColor = = BrickColor.new(TeamColorBreak) or plr.Name = = "Simpoxus" or "mord3chai" or "Froggy_Fellow" then |
34 | game.Lighting.FogEnd = brokenFogEnd |
35 | game.Lighting.Brightness = brokenBrightness |
36 | game.Lighting.Ambient = Color 3. fromRGB(brokenAmbient) |
37 | RemoteEvent:FireAllClients() |
42 | Fixed.Parent = ReplicatedStorage |
43 | Broken.Parent = GeneratorFolder |
44 | ClickDetector.MaxActivationDistance = 0 |
45 | script.Parent.Parent.Parent.Lever 2. Hitbox.ClickDetector.MaxActivationDistance = 4 |
47 | RemoteEvent:FireAllClients() |
54 | ClickDetector.MouseClick:Connect(onClick) |
**It's really odd, and I don't know why the fog and ambience stays the same after I press the fix lever.
If you can help me correct my code with any mistakes, do so.
Once again, thanks!**
Update 1: I noticed this only happened in his game, not mine which is really weird.