|
| 04 Jul 2016 09:11 PM |
local chamber = script.Parent.Parent.Parent.Parent local l1 = script.Parent.Light1 local l2 = script.Parent.Light2 local l3 = script.Parent.Light3 local l4 = script.Parent.Light4 local status = script.Parent.ContainmentStatus local text = script.Parent.ContainmentText local active = chamber.Light1.Active.Value local control = chamber.Light1.Control.Value local contain = script.Parent.Contained.Value local active2 = chamber.Light2.Active.Value local control2 = chamber.Light2.Control.Value local active3 = chamber.Light3.Active.Value local control3 = chamber.Light3.Control.Value local active4 = chamber.Light4.Active.Value local control4 = chamber.Light4.Control.Value
l1.MouseButton1Click:connect(function() if active == true and control == true and contain == true and control2 == true and control3 == true and control4 == true and active2==true and active3==true and active4==true then chamber.Light1.Light.Light.Brightness = 0 chamber.Wall1.CanCollide = false status.BorderColor3 = Color3.new(170,0,0) status.BackgroundColor3 = Color3.new(170,0,0) text.BorderColor3 = Color3.new(170,0,0) text.BackgroundColor3 = Color3.new(170,0,0) l1.BorderColor3 = Color3.new(170,0,0) l1.BackgroundColor3 = Color3.new(170,0,0) l1.Text = 'INACTIVE' text.Text = 'COMPROMISED' control = false -- The intended areas to change the values, however it does not change them contain = false script.Parent.Parent.Alarm:play() else if active == true and control2 == true and control3 == true and control4 == true and active2 == true and active3 == true and active4 == true and control == false and contain == false then chamber.Light1.Light.Light.Brightness = 100 chamber.Wall1.CanCollide = true status.BorderColor3 = Color3.new(0,170,0) status.BackgroundColor3 = Color3.new(0,170,0) text.BorderColor3 = Color3.new(0,170,0) text.BackgroundColor3 = Color3.new(0,170,0) l1.BorderColor3 = Color3.new(0,170,0) l1.BackgroundColor3 = Color3.new(0,170,0) l1.Text = 'ACTIVE' text.Text = 'CONTAINED' script.Parent.Parent.Alarm:stop() control = true contain = true else if active == true and control == false and contain == false and active2 == false or active3 == false or active4 == false or control2 == false or control3 == false or control4 == false then chamber.Light1.Light.Light.Brightness = 100 chamber.Wall1.CanCollide = true l1.BorderColor3 = Color3.new(0,170,0) l1.BackgroundColor3 = Color3.new(0,170,0) l1.Text = 'ACTIVE' control = true elseif active == true and control == true and contain == false or control2 == false or control3 == false or control4 == false or active2 == false or active3 == false or active4 == false then chamber.Light1.Light.Light.Brightness = 0 chamber.Wall1.CanCollide = false l1.BorderColor3 = Color3.new(170,0,0) l1.BackgroundColor3 = Color3.new(170,0,0) l1.Text = 'INACTIVE' control = false end end end end)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
Haxelgem
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 67 |
|
|
| 05 Jul 2016 01:23 AM |
Can you give a bit more detail on what's wrong? Perhaps an error log?
Thanks. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 02:11 AM |
We can't help if you don't tell us what the problem is directly, we're not going to look through your messy code.diagnose your problem then answer it?! It doesn't work like that.
|
|
|
| Report Abuse |
|
|
|
| 05 Jul 2016 04:20 AM |
Apologies, the problem occurring as I've marked on line 31 is the fact the value won't change on command. As a result, it is messing up the function of the entire chamber it was intended for itself.
|
|
|
| Report Abuse |
|
|
| |
|
Haxelgem
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 67 |
|
|
| 06 Jul 2016 05:07 AM |
| I see the problem. To fix your script, you'll need to replace your boolean variables with the object reference directly. In other words, control = false should become chamber.Light1.Control.Value = false. The reason for this is that once you assign a variable with a boolean value, it creates a copy of the value. When you changed the variable, you're not changing the source, just the copy, in this case. |
|
|
| Report Abuse |
|
|
Haxelgem
|
  |
| Joined: 18 Jul 2009 |
| Total Posts: 67 |
|
|
| 06 Jul 2016 05:08 AM |
| Alternatively, you could define your control variables as local control = chamber.Light1.Control (leave off the .Value). This would make them a reference to the BooleanValue. You could then replace the variable accesses with control.Value = false. |
|
|
| Report Abuse |
|
|