Able to change boolValue.Value but could not change the other boolvalue.Value

Hey there! ive been scripting around and i came to an error that I have no idea how to fix. The problem is that i am able to change a boolvalue for Equip to true but unable to change Selected boolvalue to true using .Value but they are both boolvalues. Output error was “attempt to index boolean with ‘Value’”
Both Boolvalues exists in the workspace. Any help would be great.
Capture

for i,v in pairs(script.Parent.Parent.Parent.ScrollingFrame:GetChildren()) do
				if v:IsA("UIGridLayout") == false and times == 0  and v.Equip.Value == false then
					v.Equip.Value = true --this had no problems
				    v.Selected.Value = true --this causes and error mentioned above
					times = 1
				else	
				end
			end
2 Likes
for i,v in pairs(script.Parent.Parent.Parent.ScrollingFrame:GetChildren()) do
				if v:IsA("UIGridLayout") == false and times == 0  and v.Equip == false then
					v.Equip = true
				    v.Selected = true 
					times = 1
				else	
				end
			end

Hope it works. You can try, cause maybe the “Value” was a problem.
If that doesn’t work, reference both the equip and selected.Value variables in a script.

1 Like

Thanks for the suggestion. I have tried both of the methods,no error outputs but when i refer to the workspace both boolValues will still remain false.


Capture

1 Like

I’m pretty sure an ImageButton has a property called Selected (which is a boolean), and the script is mistaking that with the BoolValue of the same name you want to change.
All you need to do is using FindFirstChild (in this case v:FindFirstChild("Selected").Value = true) to tell the script to find a child of the object, not a property

3 Likes

Oh I didnt know ImageButton had a property called selected! So in order to know if its selected i could just use the Property that is already built in right?Thanks for the information!

2 Likes

tmi but you really saved me alot of time i was planning on rewriting the entire system tomorrow and it wouldnt even be fixed thanks alot man

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.