The Unequip doesn’t work at all. None of the prints that I set up for the Unequip runs. The Equip works fine.
-- Services
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
-- Folders
local RSStorage = RS.Storage
local Models = RSStorage.Models
local Weapons = Models.Weapons
local WeaponsWeld = script.Welds.Weapons
local Events = RSStorage.RemoteEvents
local AnimationsFolder = RSStorage.Animations
local WeaponsAnimationsFolder = AnimationsFolder.Weapons
-- Events
local WeaponsEvent = Events.WeaponsEvent
-- Objects
local welds = {}
-- Animations
local EquipAnims = {}
local UnEquipAnims = {}
local IdleAnims = {}
-- Values
local EquipDebounce= {}
-- Main Scripting
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local torso = char.Torso
char:SetAttribute("Equipped", false)
local Weapon = Weapons.Katana
Weapons.Parent = char
welds[plr] = WeaponsWeld.Katana.IdleWeaponWeld:Clone()
welds[plr].Parent = torso
welds[plr].Part0 = torso
welds[plr].Part1 = Weapon
end)
end)
Players.PlayerRemoving:Connect(function(plr)
if welds[plr] then
table.remove(welds, table.find(welds, welds [plr] ))
end
end)
--
WeaponsEvent.OnServerEvent:Connect(function(plr, action)
local char = plr.Character
local hum = char.Humanoid
local torso = char.Torso
local rightarm = char["Right Arm"]
if action == "Equip/Unequip" and not char:GetAttribute("Equipped") and not EquipDebounce[plr] then -- Equipping
EquipDebounce[plr] = true
print("Equipped")
IdleAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimationsFolder.Katana.Idle)
EquipAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimationsFolder.Katana.Equip)
EquipAnims[plr].Priority = Enum.AnimationPriority.Action
EquipAnims[plr]:Play()
EquipAnims[plr]:GetMarkerReachedSignal("Weld"):Connect(function(Param)
print ("Weld made")
welds[plr].Part0 = rightarm
welds[plr].C1 = WeaponsWeld.Katana.HoldingWeaponWeld.C1
end)
EquipAnims[plr]:GetMarkerReachedSignal("Equipped"):Connect(function(Param)
print ("Idle Anim Played")
IdleAnims[plr].Priority = Enum.AnimationPriority.Idle
IdleAnims[plr]:Play()
char:SetAttribute("Equipped", true)
EquipDebounce[plr] = false
end)
elseif action == "Equip/Unequip" and char:GetAttribute("Equipped") then -- Unequipping
char:SetAttribute("Equipped", false)
EquipDebounce[plr] = true
print ("Unequipped")
IdleAnims[plr]:Stop()
UnEquipAnims[plr] = hum.Animator:LoadAnimation(WeaponsAnimationsFolder.Katana.Unequip)
UnEquipAnims[plr]:Play()
UnEquipAnims[plr]:GetMarkerReachedSignal("Weld"):Connect(function(Param)
print ("Weld2 Made")
welds[plr].Part0 = torso
welds[plr].C1 = WeaponsWeld.Katana.IdleWeaponWeld.C1
end)
UnEquipAnims[plr]:GetMarkerReachedSignal("Unequipped"):Connect(function(Param)
print("Equipped = false")
char:SetAttribute("Equipped", false)
EquipDebounce[plr] = false
end)
end
end)