God Mode Admin Command

I’m making an Admin Command script known as “god” which gives the player the health of “math.huge”.

The issue is that having math.huge health won’t work when working with parts or weapons that set the Humanoid’s Heath to reason. I want the player who has math.huge health even when they touch a part that sets the player’s health to zero.


If you don’t get what I mean, then here’s an example:


Me: I used the god admin command which gave my humanoid math.huge health
Kill Part: Has a script that kills players using this: Humanoid.Health = 0
Issue: A player with math.huge health would die if they touch a kill part that sets their health to zero.

Question: Is it possible to make a player completely invincible? If so, how would make a god command for that?

This may be a stupid question, but you never know ¯\_(ツ)_/¯ .

Please note that I’m not asking a complete script or system for me. I just need to know if this is possible and how I could do this

Just don’t set humanoid.health to 0, do -100 or something

If you have HD admin or any other popular admin commands, when you make a kill brick then the god mode wont work.

Because you are “setting” player’s health to 0.
If these admins commands are private then add this script in your kill brick.

if (humanoid.Health ~= math.huge) then
    humanoid.Health = 0
end

Other solution is, when player dies and have god mode then you can teleport them to their old position.

local pos = character:GetPrimaryPartCFrame()
humanoid.Died:Connect(function()
    character:SetPrimaryPartCFrame(pos)
end)
3 Likes

U can use 2 things to prevent the character death
Humanoid State and Humanoid.BreakJoints on death

1 Like
local hum = -- humanoid somewhere
hum:SetStateEnabled(Enum.HumanoidStateType.Dead,false)
hum.BreakJointsOnDeath = false

hum.HealthChanged:Connect(function(health)
   hum.Health = hum.MaxHealth
end

This solution completely ignores the death of the character

This is EXACTLY what I am looking for. Thank you so much!

1 Like

Alternatively, you could just use Humanoid:TakeDamage(X), where X is some arbitrary number over 100 (or whatever their maximum health will be.) This’ll prevent people dying while they have a ForceField.

1 Like