Knocked/executing system

So i’ve made several posts similar to this but didn’t manage to make this system work as intended and it’s just buggy and glitchy.If you wanna see the system i’m trying to make here are 2 links :
1- https://youtu.be/iBegXx11Zrg?t=28
2- DONT WATCH THIS VIDEO - YouTube

As you can see when player reaches very low health he plays the knocked idle animation and when he is moving he plays the knocked moving one and he has a gui that says “hold f to slow blood loss” , And by the perspective of the other player he can kill/execute or just revive with a custom animation! Pls if anyone could help it would be very helpful ! (And btw include line of code if possible!)

And thx in advance!

1 Like

All I can say is, you can use object value instances or something similar to check if they’re Knocked out same with, moving while knocked out, and the same with reviving/gripping just set up some values to check the state of the player then use some if statements to make sure nothing overlaps and you’re pretty much done. Pretty much everything comes down to situational thinking “What if he’s knocked down what do we do?” etc

Ok i’ll try to do something with ur suggestion! (I don’t know how i’m gonna make this but yeah)

as for initiating the Knockdown, most games just make’s sure the health of the player doesn’t go 0, they put it at 0.01 which means the Knocked out state, then if they grip they can just set the K.O’d player hp to 0 which means death

1 Like

Yeah i understand how it works now i need the scripting part.

It’s somewhat complicated(well not really just the thinkering of multiple situation to fix the possible bugs) but if its just K.O/Grip/Revive that’s pretty easy, just make a system that can get the state of the current player and you’re pretty much done

Example:

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(Char)

local Humanoid = Char:WaitForChild("Humanoid")

Humanoid.HealthChanged:Connect(function()
if Humanoid.Health <= 0.01 and Humanoid.Health >= 0.01 then
Player.Data.State.KnockedDown.Value = true --- you don't really need to use instances, you can even use the new attributes or use tables, it just comes down to what you think is easier to work with.
---rest is just the animation making sure character can't move? etc etc.
end
end)

end)
end)

as for how are we gonna grip?, well you have to get an hitbox(Region3/touched/Raycast) whatever you prefer and just if TouchedPart.Parent.State.KnockedDown.Value == true then --- the stuff to do when gripping end same with reviving.

3 Likes