Log in to vote

How to make if player get damage above 15 then take ragdoll or animation?

Asked by 14 days ago

Hi. I trying to make it, but my level of scripting bad(My English is poor..sorry)

thank you in advance

0 please make an attempt TTChaos 750 — 14d

1 answer

Log in to vote
Answered by 14 days ago
Edited 13 days ago

You first need to find the value of the player's health to see when he takes more than 15 points of damage. The Humanoid has a property of Health and MaxHealth, MaxHealth simply means whats the max health the player can have, the health shows how much health the player has.

--Everything is in a local script inside StarterPack.

--We find the humanoid.
--We find when the player lost more than 15HP.

local player = game.Players.LocalPlayer
local charcter = player.CharacterAdded:Wait()
local humanoid = charcter:WaitForChild("Humanoid")

humanoid.HealthChanged:Connect(function(health) --Health gives us whats the current humanoid's health.
    if health <= 85 then --<= means less or equal to 85, if our health is less or equal to 85 then it means we either got 15 damage or more than than.
        print("took more than 15 or 15!")
        print("took less than 15") --If we didnt take 15 or more points of damage it gives us this.

This has to be in a local script and place it in StarterPack Also when youre putting a ragdoll script, remember it has to be a server one, so try to add it with remote events somehow, if a ragdoll script you have/found has an event simply add that even here so it fires it from here. You can add animations right here in a local script, it will still work and everyone else will see the animation, unlike the ragdoll.

it dont work/. monus20022 0 — 14d
What did you do and where did you put the script? What errors did you get? RoiGipot 1 — 14d
Sorry for the long absence, the script was uploaded to StarterPlayerScripts. No errors came out. monus20022 0 — 13d
Sorry for the long absence, the script was uploaded to StarterPlayerScripts. No errors came out. where it was necessary to enter ragdoll or animation, I entered Print("work"), but it dont work. monus20022 0 — 13d
View all comments (3 more)
I editted my answer, check it out, it should work since I tried it right now in studio. Make sure to read the comments to understand what it does and how RoiGipot 1 — 13d
million thanks. Its Really cool! monus20022 0 — 13d
No problem, good luck scripting RoiGipot 1 — 13d

Answer this question