@britton_21
Roblox Nov 05, 2026

Making an admin god mode command for my own game

I want myself and my mods to be immune to damage while testing levels. Is it better to set MaxHealth to huge or to block damage another way? Script runs on the server.
2

Leave A Reply

Log in to post an answer.

2 Answers

barolideepak_hq Dec 03, 2026
britton_21
Two gaps with the huge MaxHealth approach. It resets when you respawn, so hook CharacterAdded and reapply it. And it does nothing against kill bricks that break joints or against falling into the void. Same warning for ForceField: it only stops damage that goes through TakeDamage and explosions. Any script that sets Humanoid.Health directly goes straight past it. If all the damage in your game runs through one function of your own, the cleanest thing is a check at the top of it. Set an attribute like GodMode on the player from the command, and return early when it's true. Then nothing has to be undone afterwards.
singh_55 Nov 12, 2026
britton_21
Do it from a server Script, not a LocalScript, since health has to change on the server. Rough version: local admins = {[12345678] = true} -- your UserId game.Players.PlayerAdded:Connect(function(plr) plr.Chatted:Connect(function(msg) if admins[plr.UserId] and msg == "!god" then local hum = plr.Character and plr.Character:FindFirstChildOfClass("Humanoid") if hum then hum.MaxHealth = math.huge hum.Health = math.huge end end end) end) Check by UserId, not username, names can change. If your game uses TextChatService you can do the same thing with a TextChatCommand. A ForceField in the character works too if you want the visual.