Setting a bool value through value.value

Is it possible to set a bool value like this or something similar to this?

image

What a funny question
To put it simply, yes this should work., you can test it yourself by doing print(BoolValue) after you set it.

local BoolValue = script. Parent. BoolValue
BoolValue.Value = true

This wouldn’t work. The “BoolValue” value is just the value of the boolvalue when it was defined, setting it to true would only just set it to true in the script.

1 Like

I was trying to do it like this so I could pass it through a function

like this
image

I say its a question about bool value but its really about a table, the goal is to get boolvalue to say true
image

Can’t you do:

local function Set(TargetedInstance, TargetedValue)
TargetedInstance[TargetedValue] = true
end

?

yeah I could, I was just wondering if there was another way so I didnt have to put 2 values

1 Like

That wouldn’t work, you should just pass an instance to the function.

local BoolValue = script.BoolValue -- check if this a BoolValue?

local function Set(BoolValue)
  BoolValue.Value = true -- pay attention to this, we set its inner Value, not the BoolValue itself
end

Set(BoolValue)
1 Like