Sword Issues PLEASE HELP

Here’s my current script:

----------------------------Objects---------------------------------------
local Sheathed = script.Parent.SheathedInfiniteCosmos
local InfiniteCosmos = script.Parent.KatanaMesh
-------------------------Sounds-------------------------------------
local Swing1 = script.Parent.KatanaMesh.Swing1
local Swing2 = script.Parent.KatanaMesh.Swing2
local EqUeq = script.Parent.KatanaMesh.EqUeq
local Clash = script.Parent.KatanaMesh.Clash
------------------------Effects------------------------------------
local BlackSmoke = script.Parent.KatanaMesh.Attachment1.BlackSmoke
local BlueSmoke = script.Parent.KatanaMesh.Attachment1.BlueSmoke
local Dots = script.Parent.KatanaMesh.HitBox.Dots
local Sparks = script.Parent.KatanaMesh.ClashFX.Sparks
local Light = script.Parent.KatanaMesh.ClashFX.SparkLight
local Trail = script.Parent.KatanaMesh.Trail
---------------------------Other---------------------------------------------
local UIS = game:GetService("UserInputService")
local EquipAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Equip)
local IdleAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Idle)
local UnequipAnim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Unequip)

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.One then
		EquipAnim:Play()
		EqUeq:Play()
		wait(0.6)
		Sheathed.Transparency = 1
		InfiniteCosmos.Transparency = 0
		BlackSmoke.Enabled = true
		BlueSmoke.Enabled = true
		Dots.Enabled = true
		Trail.Enabled = true
		IdleAnim:Play()
	end
end)

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Two then
		IdleAnim:Stop()
		EqUeq:Play()
		UnequipAnim:Play()
		wait(0.65)
		Sheathed.Transparency = 0
		InfiniteCosmos.Transparency = 1
		BlackSmoke.Enabled = false
		BlueSmoke.Enabled = false
		Dots.Enabled = false
		Trail.Enabled = false
	end
end)

the reason why it says Enum.KeyCode.Two and its not also Enum.KeyCode.One like the equip button is because when I do so it will just play both the equip and unequip anims at the same time. plese help me fix this part! I also need to know how to make it to where u ccan only press 2 (unequip) if the sword is already out. If it’s even possible i need help on how to make is to where it’s just 1 that u press not 1 and 2.

The reason why you don’t see any tool unequipped or tool equipped is because this isn’t a tool. The sword is jointed to a custom r6 StarterCharacter so it’s easier for me to add more movement to the sword.

Also if it’s possible I would love to know how to add an equip and unequip cooldown AND a swing animation on-click function. I already have the animations I just need to part of the script where it makes them play when u click (with a cooldown ofc).

thanks!

2 Likes