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

Can you make a tool force equip?

Asked by 8 years ago

I was wondering if you could make it so a tool can't unequip.

If you know whether it can or not, and you know how to do it, please answer. Thanks!

3 answers

Log in to vote
0
Answered by
rexbit 707 Moderation Voter
8 years ago

Yes, the EquipTool() method. This method is a function of Humanoid.

player.Humanoid:EquipTool(tool)
Ad
Log in to vote
0
Answered by
XAXA 1569 Moderation Voter
8 years ago

Force the player's humanoid to equip the tool every time they try to unequip it with EquipTool.

tool = script.Parent

tool.Unequipped:connect(function()
    local player = game.Players.LocalPlayer
    local character =  player.Character
    local humanoid = character:WaitForChild("Humanoid")

    humanoid:EquipTool(tool)
)
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
wait(0.001)
EnableBackpackGui = false  --Change it to true if you want to keep backpack icon
Weapon = script.Parent.Name --Place it in a tool
local player = game:GetService("Players").LocalPlayer --Use a local script
local mouse = player:GetMouse(); --Get mosue
local char = player.Character --Character
local tool = player.Backpack:FindFirstChild(""..Weapon.."") --Find tool
db=1
while wait() do
if char then
game.StarterGui:SetCoreGuiEnabled(2,EnableBackpackGui) --Check if Icon is enabled.
for i,v in ipairs(char:GetChildren()) do
if v.className ~= ""..Weapon.."" then
wait()
if db == 1 then
player.Character.Humanoid:EquipTool(tool) --Force equip tool
db=2
end
end
end
script.Parent.Unequipped:connect(function() --If unequipped
db=1 --Make equipped
end)
end
end

Answer this question