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

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

Asked by 2 years ago

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

thank you in advance

0
https://idownvotedbecau.se/noattempt please make an attempt User#30567 0 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years 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!")
    else
        print("took less than 15") --If we didnt take 15 or more points of damage it gives us this.
    end
end)

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.

0
it dont work/. monus20022 0 — 2y
1
What did you do and where did you put the script? What errors did you get? RoiGipot 1 — 2y
0
Sorry for the long absence, the script was uploaded to StarterPlayerScripts. No errors came out. monus20022 0 — 2y
0
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 — 2y
View all comments (3 more)
0
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 — 2y
0
million thanks. Its Really cool! monus20022 0 — 2y
0
No problem, good luck scripting RoiGipot 1 — 2y
Ad

Answer this question