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

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

Asked by 4 years ago

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

0
Set Humanoid.JumpPower to 0., adn to whatever whenever you want the player to jump User#23252 26 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
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

0
its causing issues with seats in my game TrippeDanieI 21 — 4y
Ad
Log in to vote
0
Answered by
Dfzoz 489 Moderation Voter
4 years ago

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.

Answer this question