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)
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()
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
.