This is a parry script I made for a sword, it works by firing an event when the mouse button is pressed down which parries, and when the mouse is up it cancels the parry. There is something wrong with the statements but I cannot see it at all, does anyone see the problem?
LocalScript:
Mouse.Button2Down:Connect(function()
if Equipped == true then
Down = true
print(Down)
script.Parent.Block:FireServer(Direction, Down)
end
end)
Mouse.Button2Up:Connect(function()
if Equipped == true then
Down = false
print(Down)
script.Parent.Block:FireServer(Direction, Down)
end
end)
ServerScript:
script.Parent.Block.OnServerEvent:Connect(function(Player, Direction, Down)
local LeftBlock = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.LeftBlock)
local RightBlock = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.RightBlock)
if Down == true then
if Direction == "Left" then
Block = true
LeftBlock:Play(nil, nil, 0)
elseif Direction == "Right" then
Block = true
RightBlock:Play(nil, nil, 0)
elseif Down == false then
print("work")
Block = false
LeftBlock:Stop()
RightBlock:Stop()
end
end
end)