Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make it so a player can't unequip a tool?

Ok so I have animations for everything on my gun now. I've scripted it so it'll fire, now I need the reload. I don't know how to make an appropriate debounce for this, so I just want to disable the tool while they reload so they can't dequip it or equip any other tools. How can I do this?

2 comments

0

I think this is what your asking for https://m.youtube.com/watchv=l3-gwnfjovm

0

You can disable backpack

1 answer

Try this script its not the best though

game:GetService("Players").PlayerAdded:connect(function(player)
 local function hookTool(tool)
  if not tool:IsA("Tool") then return end
  game:GetService("RunService").Heartbeat:wait()
  tool.Parent = player.Character
 end
 
 player:WaitForChild("Backpack").ChildAdded:connect(hookTool)
 
 player.ChildAdded:connect(function(child)
  if child:IsA("Backpack") then
   child.ChildAdded:connect(hookTool)
  end
 end)
 
 for i,v in pairs(player.Backpack:GetChildren()) do
  hookTool(v)
 end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.