When I don't equip it and press q, It's still cloning the sword model into my Character.
local Tool = script.Parent.Parent
local IS = script.Parent.IsSheathed
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local char = player.Character
local torso = char.Torso
local mouse = player:GetMouse()
local ButtonPressed = false
Tool.Equipped:connect(function()
mouse.KeyDown:connect(function(key)
if key == "q" then
if not ButtonPressed then
ButtonPressed = true
print("x")
if IS.Value == false then
print("y")
script.Parent.IA.Disabled = true
script.Parent.AttackAnim.Disabled = true
--script.Parent.IAnim.Disabled = true
script.Parent.Parent.Damage.Disabled = true
script.Parent.Parent.Handle.Name = "hand"
script.Parent.Parent.SwordModel.Transparency = 1
Back = script.Parent.Parent.SwordModel:clone()
Back.Transparency = 0
Back.Parent = char
local weld = Instance.new("Weld")
weld.Name = "BackWeld"
weld.Part0 = torso
weld.Part1 = Back
weld.C0 = CFrame.new(0,0,0.6)
weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(180),math.rad(0),44.5)
weld.Parent = Back
IS.Value = true
wait(1)
ButtonPressed = false
elseif IS.Value == true then
print("z")
script.Parent.IA.Disabled = false
script.Parent.AttackAnim.Disabled = false
--script.Parent.IAnim.Disabled = false
script.Parent.Parent.Damage.Disabled = false
script.Parent.Parent.hand.Name = "Handle"
script.Parent.Parent.SwordModel.Transparency = 0
x = char:FindFirstChild("SwordModel")
if x then
x:Destroy()
end
IS.Value = false
wait(1)
ButtonPressed = false
end
end
end
end)
end)

3 comments
isn't keydown deprecated?
You can replicate with: function Activated() the code end Tool.Activated:Connect(Activated)
Just replicated "ButtonPressed" for the Activated()