there are no error code, it just doesn't seem to work
local attackCooldown = 1 local attackWindup = 0.5 local attackRange = 3 local attackDamage = 20 local char = script.Parent.Parent local hum = char:WaitForChild("Humanoid") local originalWalkSpeed = hum.WalkSpeed local canAttack = true script.Parent.AttackRemote.Event:Connect(function(plrRoot) if not canAttack then return end canAttack = false hum.WalkSpeed = 0.1 local anim = Instance.new("Animation") anim.AnimationId = "rbxassetid://7215836748" local playAnim = hum:LoadAnimation(anim) playAnim:Play() wait(attackWindup) local newDistance = (char.HumanoidRootPart.Position - -plrRoot.Position).magnitude if newDistance <= attackRange + 5 then if plrRoot.parent.Player.isBlocking.Value == true then attackDamage *= 0.5 end plrRoot.Parent.Humanoid:takeDamage(attackDamage) wait(attackCooldown) hum.WalkSpeed = originalWalkSpeed canAttack = true end end)
I think the NCP might be breaking because you defined origin walkspeed as the humanoid's walkspeed. This means when you use originalWalkSpeed, it gets the humanoid's current walkspeed. You're basically telling the script to set the humanoid's walkspeed to itself. You can fix this by writing something similar to this:
local OriginWalk = instance.new("NumberValue", char) OriginWalk.Value = hum.Walkspeed
You can then use this value later in the script, rather than originalWalkSpeed.