So, im making a script so when someone is shot and are at a certain amout of health they are downed meaning they fall and cannot move or switch tools in their backpack. It also will show a small message that isn't covering their screen that says you have been downed which goes away in a few seconds. I can't seem to understand how to start or make a script like this, if anyone can help me that would be great.
COMMUNITY QUESTION
How do I make a humanoid sit when on low health? Im a beginner
1 answer
--Make a check when the health is changed, if health is <= the min value then sit
--StarterPlayer > StarterCharacterScripts
-- I hope this works
local plr = game.Players.LocalPlayer
repeat wait()
until plr.Character
wait()
local char = plr.Character
char.Humanoid.Changed:connect(function()
if char.Humanoid.Health <= 50 then -- Change 50 to your value
char.Humanoid.Sit = true
else
--Optional
-- char.Humanoid.Sit = false
print(char.Humanoid.Health)
end
end)
1 comment
0
Please don't spoonfeed. It's frowned upon.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You can use Humanoid:ChangeState() and put that in a function called when Humanoid.HealthChanged fires.