Here is the LocalScript within the Orc enemy. It is meant to make it so the enemy gets stunned when they're hit. I commented out the wait() until since I thought that was what was causing the problem. But even the print statements won't run. Is this simply not possible for NPCs?
Humanoid = script.Parent:WaitForChild("Enemy")
-- stun animation
local Stun = Instance.new("Animation")
Stun.AnimationId= "rbxassetid://02986478822"
local canAttack = script.Parent.CanAttack
--repeat wait() until Humanoid:IsDescendantOf(game.workspace:FindFirstChild("Enemies"))
print("Made it here")
print("Made it here")
print("Made it here")
local AnimationTrack = Humanoid:LoadAnimation(Stun)
AnimationTrack.Priority = Enum.AnimationPriority.Action
local LastKnownHealth
game:GetService('RunService').RenderStepped:Connect(function()
print("RENDERSTEPPED ORC")
if LastKnownHealth then
if LastKnownHealth > Humanoid.Health then
print('Playing')
canAttack.Value = false
AnimationTrack:Play()
end
end
LastKnownHealth = Humanoid.Health
end)

1 comment
Local scripts are only meant for players. NPCs are not players, so this script won’t really work. Change it to a server (normal) script and replace the RenderStepped loop with a while true do loop (with a wait()) or the HealthChanged event on the humanoid.