code isn't working to make the gravity and lighting and map colour back to normal?
Hello everyone, I am making a game where when you press a button something happens, there is a problem though, I have made my game so the has a 50 50 chance of going low gravity and when it does go low gravity it will make the map grey and make some parts/models visible, although most of the code worked some didn't, as you can see on line 36 I made it so it goes back to normal (the time of day and the parts disappear again and gravity goes back to normal after 12 seconds), all of the code making it turn into low gravity and using the if statement to make the parts visible worked but the if statment on line 36 making it back to normal didn't . The scripit is a normal script not a local or module, its parent is the button you press to do the 5050 chance. Hopefully this isn't just roblox and you scripters can help me out, thank you!
The script is below, line 36 is the if statement that was supposed to make it back to normal.
01 | local lighting = game.Lighting |
02 | local button = script.Parent |
03 | local ClickDetector = Instance.new( "ClickDetector" ) |
04 | ClickDetector.Parent = button |
05 | ClickDetector.MaxActivationDistance = 15 |
07 | ClickDetector.MouseClick:Connect( function () |
08 | print ( "Button has been clicked." ) |
09 | button.Transparency = 1 |
10 | game.Workspace.Stand.Transparency = 1 |
11 | game.Workspace.Stand.CanCollide = false |
12 | button.CanCollide = false |
14 | local variable = math.random( 1 , 2 ) |
18 | game.Workspace.Gravity = 30 |
20 | if game.Workspace.Gravity = = 30 then do |
21 | game.Workspace.World.BrickColor = BrickColor.new( "Mid gray" ) |
22 | game.Workspace.SA.Transparency = 0 |
23 | game.Workspace.SA.CanCollide = true |
24 | game.Workspace.SpaceRock.Transparency = 0 |
25 | game.Workspace.SpaceRock.CanCollide = true |
26 | game.Workspace.Z.Transparency = 0 |
27 | game.Workspace.Z.CanCollide = true |
28 | game.Workspace.SRock.Transparency = 0 |
29 | game.Workspace.SRock.CanCollide = true |
30 | game.Workspace.L.Transparency = 0 |
31 | game.Workspace.L.CanCollide = true |
32 | game.Workspace.Y.Transparency = 0 |
33 | game.Workspace.Y.CanCollide = true |
34 | lighting.TimeOfDay = 1 |
36 | if game.Workspace.Gravity = = 30 then |
38 | button.Transparency = 0 |
39 | button.CanCollide = true |
40 | game.Workspace.Stand.Transparency = 0 |
41 | game.Workspace.Stand.CanCollide = true |
42 | game.Workspace.Gravity = 128 |
43 | lighting.TimeOfDay = 14 |
47 | if lighting.FogEnd = = 12 then do |
48 | game.Workspace.FindMe.Transparency = 0 |
49 | game.Workspace.FindMe.CanCollide = true |
50 | game.Workspace.FindMe.ClickDetector.MouseClick:Connect( function () |
51 | lighting.FogEnd = 1000 |
52 | button.CanCollide = true |
53 | button.Transparency = 0 |
54 | game.Workspace.Stand.Transparency = 0 |
55 | game.Workspace.Stand.CanCollide = true |
56 | game.Workspace.FindMe.CanCollide = false |
57 | game.Workspace.FindMe.Transparency = 1 |