Auto Equip Tool?

I already have a custom inventory system that makes it so you cant unequip tools but now I just have a problem where when you spawn in it needs to be equipped, ive looked at youtube and googled it but all of the scripts didn’t work.

CharactertAdded > Humanoid:EquipTool()

1 Like
local tool = script.Parent
tool.Parent = player.Character

Putting it inside the character makes them automatically equip the tool.

2 Likes

how do i put it inside the character?

You shouldn’t rely on others to spoon feed you, you also have to learn your self and debug the code.

Cloning the tool inside the character makes it equip automatically. In order to do this, here’s a simple demonstration.

local Players = game:GetService("Players")

local tool = --path to the tool

Players.PlayerAdded:Connect(function(player) 
          player.CharacterAdded:Connect(function(character)
           tool:Clone() -- clone the tool
           tool.Parent = character -- Clones it to the character
     end)
end)

All you have to do ( if you use my code ) is to reference the variable ‘tool’.

2 Likes

ok but how am i supposed to use that in a script, i tried ways but none of them worked, i even tried the example.

i tried ways but none of them worked, i even tried the example.

That is not a good mindset to have, if it doesn’t work, there’s obviously something wrong: figure it out, there is a lot of code to look at above to help you out.

2 Likes

It would be wise to handle this on the server rather on the client, since you never what the exploiter is going to do with local scripts.

1 Like

the problem is that it does put the tool in the players inventory it just doesnt equip it

I don’t see a reason for it to not. It’s placed in the character, it should.

well i dont really know what to say

You can use humanoid:EquipTool() and pass the argument for the tool.

local Players = game:GetService("Players")

local tool = --path to the tool

Players.PlayerAdded:Connect(function(player) 
          player.CharacterAdded:Connect(function(character)

           local humanoid = character:WaitForChild("Humanoid")
           tool:Clone() -- clone the tool
           tool.Parent = player.Backpack-- Clones it to the backpack
           humanoid:EquipTool(tool)
     end)
end)

now it doesnt even put it in the backpack

Updated the script, try again.

still doesnt work 30charssssssss

nope. i copy pasted the script again and still

No, it does indeed work. I’ve tested it my self. Show me what have you copy pasted on your end.

local Players = game:GetService("Players")

local tool = game.ServerStorage.APS

Players.PlayerAdded:Connect(function(player) 
          player.CharacterAdded:Connect(function(character)

           local humanoid = character:WaitForChild("Humanoid")
           tool:Clone() -- clone the tool
           tool.Parent = player.Backpack-- Clones it to the backpack
           humanoid:EquipTool(tool)
     end)
end)

its in serverscriptservice, it does give the tool to the player but doesnt equip it

Show me the descendants of the tool, it does work.