I’ve got this tool that has an unequip animation. It works fine if I’m just unequipping it as is, but when I equip another tool while it’s equipped, the script thinks that’s me unequipping it rather than switching to another tool. How can I fix this?
Code, just in case:
function onUnequipped(Mouse) -- Unequip Line
local Character = Player.Character
local Humanoid = Character.Humanoid
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) -- disable inventory
UnEquipAnimation:Play()
EquipAnimation:Stop()
HoldBandageAnimation:Stop()
wait(1.2)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) -- enable inventory
end
function onUnequipped(Mouse) – Unequip Line
local Character = Player.Character
local Humanoid = Character.Humanoid
wait()
local checktool = Character:GetChildren()
for i = 1,#checktool do —- check if player has another tool/swapped
if checktool[i]:IsA(“Tool”) then
return —- cancel the anim
end
end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) – disable inventory
UnEquipAnimation:Play()
EquipAnimation:Stop()
HoldBandageAnimation:Stop()
wait(1.2)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) – enable inventory
end