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

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

Asked by 4 years ago

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?

0
I think this is what your asking for https://m.youtube.com/watchv=l3-gwnfjovm JesseSong 3916 — 4y
0
You can disable backpack d1_rek 46 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
Ad

Answer this question