Attempting to index Boolean with 'Value' even though I'm not using a Boolean?

  1. What do you want to achieve? I’m trying to make a Locked Door system

  2. What is the issue? I get the error ‘Workspace.Model.Part.Script:2: attempt to index boolean with ‘Value’’

  3. What solutions have you tried so far? Devforum posts, but those all used BoolValues when I’m using a StringValue.

 while wait() do
	if script.Parent.Locked.Value == "not" then
		script.Parent.BrickColor = BrickColor.new("Really red")
		script.Parent.SurfaceGui.TextLabel.Text = "Lock"
	elseif script.Parent.Locked.Value == "is" then
		script.Parent.BrickColor = BrickColor.new("Bright green")
		script.Parent.SurfaceGui.TextLabel.Text = "Unlock"
	end
end

I’m not understanding how ‘Locked’ (A string Value) is being read as a Boolean. Maybe it’s not and I’m just confused, but either way, I’m unsure how to fix this.

.Locked is a property of the part you are using at

script.Parent.Locked

It will think you are trying to lock the part, rename the value and try again.

1 Like

“Locked” is a property of parts, and it’s a boolean: BasePart | Roblox Creator Documentation

So roblox is assuming you mean that, rather than the child which happens to be named “Locked”.

Use FindFirstChild, or rename your StringValue.

1 Like