Not recognizing BoolValue inside Tool as a valid member

At the moment I’m working on a handcuff tool, and it’s far from finished. Since I needed remote events, I need global Bool Value’s. So I added one to my tool just to check the cuffs are being used or not.

I mention it as a variable in the code.

local Cuffed = Cuffs.CuffedValue

And it says the following as an error message.
CuffedValue is not a valid member of Tool “Players.benpinpop.Backpack.Handcuffs”

I tried searching it up on the dev hub and didn’t seem to find anything. I then realized that the remote event was also named Cuffed and changed the Value name so I wouldn’t mix it up, but it continues to insist this area.

I apologize for any beginner mistakes I’m making right here, as this is my first post to the devforum.

local Cuffs = script.Parent 
local Cuffed = Cuffs.CuffedValue
local PlayerName = Cuffs.Parent.Parent.Name
local PlayerHumanoid = game.Workspace:FindFirstChild(PlayerName):FindFirstChild("Humanoid")

Cuffs.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		print(Mouse.Target)
		if Cuffed == false then
			if Mouse.Target.Parent:findFirstChild("Humanoid") then
				Mouse.Target.Parent.Humanoid.Torso.CFrame = CFrame.new(0, 20, 0)  
			end
		end
	end)
end)

local Cuffs = script.Parent 
local Cuffed = Cuffs.CuffedValue
local PlayerName = Cuffs.Parent.Parent.Name
local PlayerHumanoid = game.Workspace:FindFirstChild(PlayerName):FindFirstChild("Humanoid")

Cuffs.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		print(Mouse.Target)
		if Cuffed.Value == false then -- Needs to be Cuffed.Value == false, as Cuffed is an instance, and not the value.
			if Mouse.Target.Parent:findFirstChild("Humanoid") then
				Mouse.Target.Parent.Humanoid.Torso.CFrame = CFrame.new(0, 20, 0)  
			end
		end
	end)
end)

Edit: I think it thinks that CuffedValue is a value of the tool, not a child of it. That’s a reason you need to do Cuffed.Value.

Tested it and it does not work.

It does an error on this line.


local Cuffed = Cuffs.CuffedValue

Try this, sometimes it’s needed.

local Cuffed = Cuffs:WaitForChild("CuffedValue")

You do still need the previous code edit I made, because an error will happen saying something about comparing instance to bool.

Thank you. I added it to the code and it now works. I am surprised I didn’t think of it. :expressionless:

No problem. Hope your game does well!

1 Like