Disable tool equipping/unequipping safely

Well..
I want to disable tool equipping/un equipping safely?
What means “safely”?
As i know, by disabling backpack core gui player cannot equip or unequip tools anymore, but this is vulnerable, since exploiter can enable core gui back (as I know they can change everything on client) and equip/unequip tools which is critical to my game. is there any way to make it more secure?

Couldn’t you keep the tools in a folder and move them via server script to backpack whenever you want

The client is trusted with moving around Tools which are parented to their Backpack/character between those two locations. Is there any reason you rely on tools for game-critical logic? If possible, could you provide some context as to WHY this is critical? What are you doing precisely?

This is attempting to remove any tool back to the Backpack if it is equipped while the cooldown is true. A ServerScrip that triggers a check from ChildAdded to Character.

local Players = game:GetService("Players")
local cooldown = false

local function checkTool(item, player)
    if cooldown and item:IsA("Tool") then
        local backpack = player:FindFirstChild("Backpack")
        if backpack then item.Parent = backpack end
    end
end

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character.ChildAdded:Connect(function(item)
            checkTool(item, player)
        end)
    end)
end)

More of an untested approach. It will need some tweaking. I am not on my rig at the moment.
This should be instant enough that you would not even see it was ever equipped.
Simple approach really. Just need to get control of that cooldown setting.

Basically did something get added? If so then, if cooldown and item:IsA(“Tool”) then..

the correct approach is to replace an actual Tool with a Model of it when it is not meant to be picked up and equipped by anyone

You want a more reliable solution than a script?

Just parent all your tools to a folder in the backpack so just make a folder in backpack, and then parent all your tools there and there is nothing the exploiters can do about it since it has to be parented UNDER BACKPACK DIRECTLY but since you parented it one further in this case the FOLDER nothing will happen.

Not needed because there is a much simpler way

Thanks for the solution, but i have one more question. Should i do the same with player’s character? Make a folder that will contain equipped tools?

If your aiming for the character this isn’t the most reliable method as exploiters can just reparent the tool back to their backpack effectively defeating the point of what your trying to achieve so you should instead let the player be able to parent the tool to their character directly but have a script just check to see if the tool is unequipped and if it is you can just simply reparent it back to that folder or to the character..

The reason why they can reparent tools back from their character to the backpack is because for some reason Roblox checks for tool ownership in the character’s DESCENDANT rather than the character DIRECTLY and the Roblox servers accept the request hence replication is allowed. (It’s super weird so you have to get creative)

Now if you dont want them to even be able to reparent the tool to their backpack, then it gets a bit more complex but you can recode the scripts to support it here’s how to do this:

  1. Make a model in the player’s character (This will be the replacement of the tool)
  2. You then clone/reparent everything from the original tool to this model
  3. You can then enable all the scripts (Remember this is parented to the character so localscripts will work too)
  4. MAKE A WELD FROM THE HANDLE TO THE RIGHT ARM (R6) / RIGHT HAND (R15) [Otherwise the tool will fall out of your hand and maybe into the void and get removed)
  5. Enjoy!

Remember you will have to rely entirely on input events since you are not using the tool classname anymore. So just make sure you have some remotes to handle the client’s requests.

And of course if you wanted to reverse this you can just have a remote to simply remove the tool from the character which is in this case the model we created. I hope this helps

So in summary:

You can effectively disable equipping tools by reparenting all the tools from the backpack to a folder in the backpack but you cant do the same vice versa since Roblox allows this type of request when it’s in the character and I have no clue why.. (They should fix this honestly)