Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Best approach to creating a bleeding system?

So I'm planning to create a bleeding system so that when a player gets hit by a bullet, they gradually lose health until they use bandages. I was thinking creating a disabled local script and putting it in starter character scripts and enabling it when the bullet hits the player. Then when they use bandages, it will disable the script. Are there any better methods to do this? Let me know!

3 comments

0

I would use a value inside player, using server to watch for changes and cause damage

0

id raycast blood decals to the floor or create parts that are red on the player..

0

Thanks for the suggestions guys

2 answers

Make a table that holds all damaged players in it and then have a for loop to get all of the damaged players and then damage them, then run the for loop every second.

1 comment

0

Thanks for the answer!

I figured out how I will make the system. Leamir mentioned values and so an idea popped up in my head. Formally, I had it so that there was a server script in ReplicatedStorage which would clone and parent to the humanoid everytime a bullet hit it. And then in a loop, it would decrease the player's health. And then I was going to make it so that when using a medkit, it would find all scripts named "Bleeding" under the humanoid and destroy it. This probably is the worst possible way to do this.

So what I'm instead going to do is make an IntValue in the humanoid named Wounds and a server script in the humanoid named bleeding which would be disabled to start out so that the loop in the script won't kill the server. Then, when a bullet hits, it will increase the wounds value by 1 and also enable the bleeding script. The bleeding script will then decrease the player's health in a loop multiplied by the number of wounds. When the player uses a medkit, it will decrease the wounds to 0 and the bleeding script will automatically disable. Let me know if there are better ways than this!

This discussion is preserved as it was. New answers, comments, and votes are closed.