How could I make a player unable to take any form of damage?
I am currently trying to make a sort of safezone for players, and I want them to not be able to take any damage while inside the safezone. I already know how to detect when players are in the safezone. I only need to figure out how to make the player invincible. I do not want to change the player’s health to a higher amount to make them “invincible”.
In your script that deals damage, check if the player is in a safe zone since you already know how, and then ignore the damage.
Another method would be to give a forcefield when they are in the safe zone.
But then the forcefield would be visible won’t it? Also I can’t use your first method because I want to do this in a separate script, and also there are many scripts that deal damage.
In my time I had an almost similar problem, the solution I came to was, in which the player has a boolValue called Safe, and check in the same damage script if the boolvalue is true, if it is true it will not do damage and if it is false it will hurt. You can apply my same method.
Another method is to check if they are in a safezone and always set their health to the max
if playerisinsafezone then
while wait(.1) do
Humanoid.Health = Humanoid.MaxHealth
end
end
This code will wait if the player is in a safezone and constantly set their health to the max health of the player.
There are many different damage scripts, and I don’t want to do this for all of them, is there any way to just stop them from taking damage?
He said he can’t do this method because he has too much damage scripts.
Good idea, but I have a healthbar in the bottom left of the screen, so it would be blatantly obvious that the player is still taking damage and getting regenerated.
Then for a safezone you can either make the health bar gui invisible or just have a static image of a full health visible so it looks like they are taking no damage.
Yeah but that’s a hacky method. Is there any way to just completely stop the player from taking damage?
From what I know, there is no way unless you modify the damaging scripts itself.
ok what if I was trying to make a forcefield (I need a forcefield and a safezone lol) what would I do, since I cant change the players health value or it will affect the healthbar? Also I want it to be a custom forcefield so I don’t want to use roblox’s forcefield
Roblox has a built in forcefield that you can use. Read the article below.
https://create.roblox.com/docs/reference/engine/classes/ForceField
I said I wanted to make a custom forcefield.
I just edited this method and did something similar to it. Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.