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)
Don't think you should use a Part.Touched inside a remote because every time you click (fire the remote) it will make a new connection.
If its a tool object, its probably best to script it all from the server, using Tool.Activated,
If its for a kick and you don't require them to hold a tool, you should get the parts touching the object.