Tool Equipping and Unequipping Prevention

Hi, I’m working on a Tool based Gun System I’m currently having an issue with the animations if the player equips and unequips the tool really fast I’m trying to prevent this and I’m wondering what methods I could use to prevent the player from equipping the gun and unequipping the gun in a short period of the time, So something like the player equips the gun then they can’t equip it for a few seconds.

1 Like

I think a better way to approach this problem is to have the animations properly stop after being unequipped. What does the code look like?

1 Like

I may not sure how does like but i try give suggestion

Set backpack core false will prevent tool being equipped even unequipped but still can drop if CanBeDropped = true

Clientside

First “Simple delay using wait()”

local tool=script.Parent
tool.Equipped:Connect(function()
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
	task.wait(1)
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
end)

Second “Depend how long animation delay”

local tool=script.Parent
local player=game.Players.LocalPlayer
local equipanim=player.Character:WaitForChild('Humanoid',9):LoadAnimation(script.EquipAnimation)
tool.Equipped:Connect(function()
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
	anim.Stopped:Wait()
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
end)
2 Likes

thank you this works for what im trying to do

Yeah I made a module managing animations and it works really well I’ve been using it for months on end now and no issues stopping animations or anything

I just reference that way from “criminality” that how work look like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.