generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Problem with Changing Values

Previous Thread :: Next Thread 
nickanator4 is not online. nickanator4
Joined: 25 Aug 2012
Total Posts: 36
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
nickanator4 is not online. nickanator4
Joined: 25 Aug 2012
Total Posts: 36
04 Jul 2016 09:51 PM
Bump


Report Abuse
nickanator4 is not online. nickanator4
Joined: 25 Aug 2012
Total Posts: 36
05 Jul 2016 01:16 AM
Bump


Report Abuse
Haxelgem is not online. 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
Justin_Trill is not online. Justin_Trill
Joined: 28 Aug 2014
Total Posts: 636
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
nickanator4 is not online. nickanator4
Joined: 25 Aug 2012
Total Posts: 36
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
nickanator4 is not online. nickanator4
Joined: 25 Aug 2012
Total Posts: 36
05 Jul 2016 11:46 AM
Bump
Report Abuse
Haxelgem is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image