Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Equip is not a valid member of Tool. Can anyone help?

Asked by 5 years ago

Roblox says Equip is not a valid member of tool, but it clearly is. This is the script that changes the BoolValue of Equipt:

local tool = script.Parent

local function onEquip()
    tool.Equip = true
end

local function onUnequip()
    tool.Equip = false
end

local function onActivate()
end

local function onDeactivate()
end

tool.Equipped:Connect(onEquip)
tool.Unequipped:Connect(onUnequip)
tool.Activated:Connect(onActivate)
tool.Deactivated:Connect(onDeactivate)

Here's Equip being a valid member of Tool: I would really appreciate if someone could help me with this.

0
By `tool.Equip = true`, you are just accessing the instance and setting it to true or false which makes no sense. You should set its value to true or false. There is a property of the instance called `Value` that is the one you should be modifying. So `tool.Equip.Value = true` valchip 789 — 5y

1 answer

Log in to vote
0
Answered by
BenSBk 781 Moderation Voter
5 years ago

To change the value of a BoolValue, or any other value object, you need to change the Value property. If you think about it, directly overriding the object itself would not work, and should not be expected to work.

To fix your script, simply append .Value to the object when changing or accessing its value:

tool.Equip.Value = true
0
AKA what I said in the comments, also maybe his Equip BoolValue hasn't been loaded yet so he might want to use `:WaitForChild()`. valchip 789 — 5y
0
your comment wasn't there when i began answering mr vamik BenSBk 781 — 5y
0
^ I know I did not complain. valchip 789 — 5y
0
has happened to me before ¯\_(?)_/¯ valchip 789 — 5y
0
Thanks, I totally forgot about .Value :) vonotige 49 — 5y
Ad

Answer this question