Need help with an in combat state

Hey there.

I am having trouble on thinking of how to start a state that takes place once you are hit just like the ones in A universal time and Stardust Odyssey.

Any guidance or scripts would be appreciated.

Hi,

The way I would accomplish this is by using Humanoid:GetPropertyChangedSignal("Health").

Here’s an example of how it would be used:

game.Players.PlayerAdded:Connect(function(Player)
  Player.CharacterAdded:Connect(function(Character)
    Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
      if Character.Humanoid.Health < Character.Humanoid.MaxHealth then
        -- Player took damage, do stuff
      end
    end)
  end)
end)

This should work for what you’re asking for, but feel free to let me know if it doesn’t or you need something else.

1 Like

Thanks, this is a good start but how would I then detect that the damage is constantly decreasing