How can I make a player invincible for (example) 5 seconds when spawn

So in a game, I’m trying to make it so that you don’t have a forcefield, but when you spawn you’re still invincible for (example) 5 seconds.
I have already found a topic like this, but it wasn’t very clear and doesn’t seem to be the same thing.

Any help would be appreciated!

You can do one of the following:

You can add the forcefield back, and make a listener that sets the forcefield’s Visible property to false.

Or… You can set their health to math.huge


But not this since this isn’t making the player invincible.

Just make the forcefield last 5 seconds and make it invisible

1 Like

Use for loop and put Character:GetChildren() as the table parameter and put in the loop the condition that it must be BasePart and if it is give it Trasparency to 1 and after 5 seconds do the same with Transparecy to 0

I don’t see the point of using math.huge on health, as Roblox already gives you a forcefield which makes the player invincible, and I believe that you can extend it’s period for as long as you want.