I have this sword script and it will not damage the enemy if the attack is parried. But the problem is that the value updates and the script is not registering the update.
client:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Debounce = false
mouse.Button1Up:Connect(function()
if script.Parent.Parent.Name == player.Name then
if not Debounce then
Debounce = true
game.ReplicatedStorage.RemoteEvent4:FireServer()
wait(1)
Debounce = false
end
end
end)
server:
game.ReplicatedStorage.RemoteEvent4.OnServerEvent:Connect(function(Player)
local value = script.Parent.Value.Value
value = true
print("hi")
local bool = false
local damages = 10
local Humanoid = Player.Character:WaitForChild("Humanoid")
local animator = Humanoid:WaitForChild("Animator")
local kickAnimation = Instance.new("Animation")
kickAnimation.AnimationId = "rbxassetid://11272296545"
-- Load the animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)
-- Play the animation track
kickAnimationTrack:Play()
--if kickAnimationTrack.IsPlaying == true then
local Part = Instance.new("Part",game.Workspace)
Part.Size = Vector3.new(6, 7, 5)
Part.CFrame = Player.Character.HumanoidRootPart.CFrame + Player.Character.HumanoidRootPart.CFrame.LookVector*5
Part.CanCollide = false
Part.Anchored = true
Part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid")then
if hit.Parent:FindFirstChild("Parrying")then
if hit.Parent:FindFirstChild("Parrying").Value == true then
print("true")
end
end
end
end)
end)

2 comments
could you give me an example
local Connection -- this will be on top now put Connection = Part.Touched:Connect() now if you dont need it its important to disable it Connection:Disconnect()