Downed and executing system

  1. **What do you want to achieve?
    I want to make a downed and executing system like the one in the game criminality
    here is a showcase of it : DONT WATCH THIS VIDEO - YouTube
    basically : (when the player hits for example 10 health he will play an animation of him knocked and a gui will appear on top of his head saying “Press E to revive or F to execute” and if he is moving he will play the knocked moving animation. And if you press F the player that pressed it will play the killing animation and will set the knocked player’s health to 0.

  2. **What is the issue?
    I do not even know where to begin , and i’m a new scripter sooo…I don’t know how to do that.
    But don’t worry i know pretty much all the basics so it wouldn’t be hard to explain the solution.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked on all of the tutorials i could find and searched on the DevForum but found nothing .

If anyone knows how to do that i’ll be very greatful and Thanks in advance!

5 Likes

Okay, so making a downed and executing system is actually pretty simple. First of all, you can use humanoid.Died to find whenever a character dies. Then, in your tool, you can create a StringValue with the name of the player who killed the other player. Then, on humanoid.Died, you find the tag in the player who died. Then you can event:FireClient(playerWhoDied, tag.Value, “DeathMessage”) or something like that. In playerGUI you can receive the event and put the text of a textlabel to: tag.Value. For the player who killed, you can just say: You killed: hitplayer.Name

1 Like

i have a problem and that is that i use fe melee kit in my melee tools so how would i go about making that and (if possible can you include script samples) so i can understand more

Well, for checking to see if a player has died:

 game.Players.PlayerAdded:Connect(function(plr)
    local char = plr.Character or plr.CharacterAdded:Wait()
    if char then
        local humanoid = char:WaitForChild("Humanoid")
        humanoid.Died:Connect(function()
            -- Put your code here...
        end
    end
end

You can create an event in ReplicatedStorage (so the client can access it as well). Then, in your sword, whenever you killed a player:

local tag = Instance.new("StringValue", killedPlayer)
tag.Value = thisPlr
local playerGUI = thisPlr:FindFirstChild("PlayerGui")
local textlabel = playerGUI.GUI.TextLabel
textlabel.Text = "You killed: "..killedPlayer.Name

And i just noticed that you miss understood what i meant.What i meant to say is that i wanna make a downed system (when player hits a certain amount of health he plays an idle animation when he isn’t moving and when he is moving he will have slow speed and have a gui on top of him saying “Press E to revive or F to execute”
And the execute one is for example if player has 10 health ,when you press F on your keyboard near him you will play an animation of you terminating him and then set his health to 0 sorry if i didn’t explain this at the beginning (it’s my first time posting on the devforum).

Oh, well… That isn’t too difficult either. You can use RunService.Stepped to continually check whether the health drops around 10. Then, you can play an animation. It is not hard to make animations, and you can play them with:

local animation = humanoid.Animator:LoadAnimation(anim)
animation:Play()
-- Make sure anim priority is Action and it's looped

To get a gui on the players’s head, you can use a BillboardGUI and apply it whenever a player joins the game. For keyboard input you can use:

local usi = game:GetService("UserInputService")
usi.InputBegan:Connect(function(key)
    if key.KeyCode = Enum.KeyCode.F then
        player.Health = 0
   end
end

Very simple. You can create another death anim and play it. Also, you can create animations by using the built-in Animation Plugin.

Ok ill try to do that and recontact you if I encounter any problems!

Ok, you’re welcome! :grinning: If you can, please list my post as a Solution. Thanks!

1 Like

i just wanted to ask how would i go about using renderstepped to check if player’s health drops and I’ve never used BillboardGui so how can i do that too? and sorry for asking a lot.

Oh, it’s all right! Anyways, here is how to use renderstepped:

local runservice = game:GetService("RunService")
runservice.RenderStepped:Connect(function()
    if plr.Health <= 10 then
        -- Insert code here...
    end
end

Making a Billboard GUI (overhead) is simple too! You can use game.Players.PlayerAdded and wait for character. To see how to make an overhead GUI watch this video by AlvinBlox:

1 Like

Make sure to make like a remoteevent or remotefunction to the server to kill the player on the server and not just the client of the user that kills, also make it only work when being near a user that’s got >0 and <10 health. Use a remotefunction or remoteevent to run the animation on the player that’s being killed’s client

Yes, but also, play the animations on the server or use :FireAllClients() so that everybody can see.

About animations on the server, animations automatically replicate to the server from the client that is using the animation on its own character.

Oh yeah, sorry 'bout that. I usually do anims from the server, so…

1 Like

You could also make a proximityprompt instead of the userinputservice way, that would automatically send the request to a server side event which can be connected to a function on the server side.

and how can i do that ? (Can you include some code with explanation?)

There is info about that here:

I would really like to script an explaination or even script the whole system for your game for you. I usually appreciate doing that.
But I do not have enough spare time. I still have a game to work on unfortunately and I hate letting thousands of people wait for its fix.

Ohh no worries i completly understand!

Hey how can i detect the nearest knocked player to the player so i can show the gui when he is knocked

Just use a ProximityPrompt, and set the distance.