Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

make player sit on low health and get back up once not on low health?

So I tried Many times it works , it sits in game , but i need to make player sit again if jumped and only get up once the health gets to a certain point heres the script to see what changes i need to make

while wait() do

local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid if humanoid.Health < 10 then -- if thecharacters health is less than ten den he sits humanoid.Sit = true humanoid.JumpPower = 0 humanoid.Speed = 0 elseif humanoid.Health > 10 then -- other wise he stands O.O end end local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid humanoid.Sit = false humanoid.JumpPower = 50 humanoid.Speed = 16

1 comment

0

Set Humanoid.JumpPower to 0., adn to whatever whenever you want the player to jump

2 answers

✓ Accepted answer
while wait() do

local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid 
if humanoid.Health < 10 then  
humanoid:Sit() 
humanoid.JumpPower = 0 
humanoid.WallSpeed = 0 
elseif humanoid.Health > 10 then 
local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid humanoid.JumpPower = 50 
humanoid.Speed = 16
end 
end 

This should work. Put it in a local script in StarterGui and it should be fine. But the indentation may not be correct as I worked off your code which was not indented.

If this helped please up vote and accept this answer.

All the best,

PrismaticFruits

1 comment

0

its causing issues with seats in my game

Maybe you can use the humanoid.StateChanged(oldstate,newstate) event and bind it to that function. You can check if oldstate == Enum.HumanoidStateType.Jumping on the function then.

This discussion is preserved as it was. New answers, comments, and votes are closed.