Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

EquipTool is not a valid member of Player HELP?

this is my script but i cant equip the tool even though it says to i put this in StarterPlayer StarterPlayerScrips LocalScript

local player = game.Players.LocalPlayer
y = 1
x = game.Lighting["Baton"]:Clone(); 
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then 
		if y == 1 then
        player:EquipTool(x)
		y = 2
		elseif y == 2 then
		player:UnequipTools()
		y = 1
		end
    end 
end)
w = game.Lighting["BillyClubRiotShield"]:Clone(); 
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then 
		if y == 1 then
        player:EquipTool(w)
		y = 2
		elseif y == 2 then
		player:UnequipTools()
		y = 1
		end
    end 
end)

2 answers

✓ Accepted answer

EquipTool and UnequipTools are methods of the Humanoid class. You are trying to call them on a Player.

player.Character.Humanoid:EquipTool(x)
player.Character.Humanoid:UnequipTools()

1 comment

0

thanks

The issue is both of these lines:

player:EquipTool(w)
player:UnequipTools()

The Player object doesn't consist of those two functions. You can't just call arbitrary functions on objects and expect them to do what you wish. Try adding the cloned tools to the player's Backpack.

6 comments

0

after i add them what do i do

0

do i do player.Backpack:EquipTool(w) or something else

0

@qwrn12 You can't force someone to equip a tool, as far as I know.

0

you can

0

They actually aren't arbitrary methods, they exist in the wiki under methods of Humanoid.

0

@1waffle1 Hmm. Didn't realize that.

This discussion is preserved as it was. New answers, comments, and votes are closed.