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

EquipTool is not a valid member of Player HELP?

Asked by
qwrn12 85
8 years ago

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

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

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()
0
thanks qwrn12 85 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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.

0
after i add them what do i do qwrn12 85 — 8y
0
do i do player.Backpack:EquipTool(w) or something else qwrn12 85 — 8y
0
@qwrn12 You can't force someone to equip a tool, as far as I know. Programmix 285 — 8y
0
you can qwrn12 85 — 8y
View all comments (2 more)
0
They actually aren't arbitrary methods, they exist in the wiki under methods of Humanoid. 1waffle1 2908 — 8y
0
@1waffle1 Hmm. Didn't realize that. Programmix 285 — 8y

Answer this question