How to make one tool hidden form the toolbar but not the whole toolbar?

Hello, I have seen multiple people ask similar questions to mine instead of one tool form the toolbar they want to remove the whole toolbar gui but that is not what I’m asking for. I have been trying to write a script to hide one tool because I have been working on a flashlight tool that is only equipped by pressing F not by clicking on it in the toolbar. It would be really appreciated if someone could help me with writing this script.

1 Like

you have to make a localscript.
put it in StarterPlayerScripts.

local Plr = game.Players.LocalPlayer
local UserInPutService = game:GetService("UserInputService")
UserInPutService.InputBegan:Connect(function(input,gp)
if gp then return end
if input.KeyCode == Enum.KeyCode.F then
if Plr.Backpack:FindFirstChild("FlashLight") then
Plr.Backpack:Equip("FlashLight")
end
end)

Change FlashLight to your ToolName.

1 Like

There were some problems when I tried it mainly on the line with

If plr.Backpack:FindFirstChild(“FlashLight”) then

There was a capitalization error on the Plr and for some reason the if then isn’t working for that line

1 Like

I think I fixed the script there’s no errors with the if then but there’s now an error with the end) part and the script still doesn’t work

1 Like

Ye i fixed the Plr, what is your tool called?

1 Like

I fixed the code can you try again?

1 Like

I figured out one of the problems I was having which was i didnt change the flashlight part with my tool ,but there seems to be a problem on

Plr.Backpack:Equip(“FlashLight”)

Wait does this script just equip the item when you press F