Astrock
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 240 |
|
|
| 03 Aug 2015 07:06 PM |
This seems incredibly easy and simple to do, yet the value will not change. I have it set on true, and when I run the script it stays true. No error pops up. While I could just use a number value, and make 0 = false, 1 = true, this has been a recurring problem that vexes me. Here is the script that doesn't seem to work:
local state = script.Parent.Parent.State.Value --State is the name of my BoolValue
state = false
I tried to put a new script as a child of the BoolValue, but that too did not work. Here is that script:
script.Parent.Value = false |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 07:12 PM |
| The latter piece of code should work fine, unless you changed it somewhere else or the script is disabled. The first one doesn't work because you're setting a variable to your BoolValue's current value, then setting that variable instead of the BoolValue. |
|
|
| Report Abuse |
|
|
Astrock
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 240 |
|
|
| 03 Aug 2015 07:16 PM |
| The script of the latter is activated, and just to make sure nothing else was changing it too, I disabled every other script. |
|
|
| Report Abuse |
|
|
Techante
|
  |
| Joined: 17 Oct 2011 |
| Total Posts: 2101 |
|
|
| 03 Aug 2015 07:21 PM |
try this:
local state = script.Parent.Parent.State
state.Value = false |
|
|
| Report Abuse |
|
|
Astrock
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 240 |
|
|
| 03 Aug 2015 07:31 PM |
With some troubleshooting, it appears that manually checking it's value won't give it's real value. I used this script:
script.Parent.Value = false print (script.Parent.Value)
if script.Parent.Value == false then print ('The value is false') end
if script.Parent.Value == true then print ('The value is true') end
And the output is always:
false "The value is false"
I was checking the little box in the BoolValue that can be check-marked or not to see if the value is true or false. Looking at the box does not give you the value it seems. The check-mark does not remove itself or add itself when the value changes. But, apparently, it only represents the real value of the BoolValue if that check-mark box was manually changed by the player. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 07:34 PM |
when the game runs, that script runs once so if something changes it to true then rip it wont detect it..
try dis
local val = script.Parent.Value
val.Changed:connect(function(prop) if prop == "Value" then print("The value is "..tostring(prop.Value)) end end)
ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 07:36 PM |
my code will run every time you change the value so whatever you change it to it will print.
ʏᴏᴜ ᴛʜᴏᴜɢʜᴛ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴅʀᴀɢ ᴍᴇ ᴛᴏ ᴛʜᴇ ʙᴏᴛᴛᴏᴍ ᴏғ ᴛʜᴇ ʟᴀᴋᴇ sᴏ ʏᴏᴜ ᴄᴏᴜʟᴅ ᴇᴀᴛ ᴍᴇ ʟᴀᴛᴇʀ... ᴡᴇʟʟ ɢᴜᴇss ᴡʜᴀᴛ ᴘᴜɴᴋ... ɪᴍ ᴀ ғɪsʜ... ᴡɪᴛʜ ʟᴇɢs |
|
|
| Report Abuse |
|
|