Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a humanoid sit when on low health? Im a beginner

Asked by 5 years ago
Edited 5 years ago

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.

0
You can use Humanoid:ChangeState() and put that in a function called when Humanoid.HealthChanged fires. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
0
Answered by
174gb 290 Moderation Voter
5 years ago
Edited 5 years ago
--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)

0
Please don't spoonfeed. It's frowned upon. DeceptiveCaster 3761 — 5y
Ad

Answer this question