Why are my anti-godding and anti-health setting scripts not working?

Humanoid.Health property is automatically limited by humanoid.MaxHealth. Just check if their MaxHealth is greater than whatever limit you want. I don’t know about the “anti-god” part, but you automatically get respawned whenever your character is missing a humanoid. The weird thing is, if you delete your humanoid server-sided, this weird respawning behavior doesn’t happen. Also, changing your health from a LocalScript doesn’t replicate, so I wouldn’t bother with checking that.

Well, how do you think I should edit my script then, for anti god, for anti health I made if greater than Character.Humanoid.MaxHealth instead of my local. Oh and when I tested it with Kohl’s and set my health to 1000, it didn’t kick me.

Client side scripts (local scripts) cannot kick players, you also don’t need to worry about a players health unless your remote events have a vulnerability which means a client can call the server to edit their health - in which case you should really improve this.

In regards to the health being changed on the client side → it has no effect on server side operations aka they aren’t actually godded, they have the false impression.

1 Like

I would just toss out the part where you check if a client is tampering with their health. You shouldn’t really care about “fe god” since it’s basically obsolete at this point. But if you wanted to, you can check if their humanoid is missing, using a server script

You can kick yourself from a LocalScript. It just sucks, because literally every exploiter has a script that combats this.

It wouldn’t, as the client can delete their own humanoid without the server ever knowing - the server will handle things as if one exists.

You can delete any descendant of your own character and it’ll replicate. Anything.

1 Like

Defending through the client is a stupid method however as you can just delete the local script. Not to mention, yes you can mess with your own character but to little relevant effect mainly: because the server can easily pick up on any changes the client side makes. This can lead to a bunch of issues for themselves anyway.

If you really want to detect these though @node_modules1 :

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(ANY_CHECKS_FUNCTION)
		Character.DescendantAdded:Connect(ANY_CHECKS_FUNCTION)
		Character.DescendantRemoving:Connect(ANY_CHECKS_FUNCTION)
	end)
end)

Left you the check functions to write, if you don’t want them to do anything then obviously just place a kick statement (as sometimes it might be a server done event). We’ve used Descendant instead of Child incase they place it within any part of the character as its very easy to define new parents for malicious scripts.

Have fun scripting :smile:

1 Like

So well, for anti godding, this is what I should put in ServerScriptService, or is this for Anti Health which I should put where?

I’m not exactly sure how your game works, but I might know how to fix your problem.

Now It wouldn’t exactly be a “ani-god” as such, but It might prevent them from using the humanoid godmode glitch.

If what you’re doing is humanoid:takedamage() or humanoid.Health = 20 add a check in server script form for if the humanoid is below 0.

If the humanoid is below 0 then you can break the players joints.

If you already do this then my advice might be usless to you.

anyway what I came up with is something along the lines of:

local Players = game:GetService("Players");

Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(char)
		local humanoid = char:WaitForChild("Humanoid");
		humanoid.Changed:connect(function(property)
			if property == "Health" then
				if humanoid.Health <= 0 then
					char:BreakJoints();
				end
			end
		end)
	end)
end)

All of this code is made in the reply box and is untested. adjustments can be made, I think you should give it a try!

So this should be a server script?

Yes, It is a server script. Essentially what it’s doing is checking if the humanoid on the server is below 0 and if it is, it will break the character’s joints in turn killing the clients humanoid.

Hm, but the thing is, when I god myself, meaning 0 or below health it is, it’s not killing me.

What type of god-mode thing are you using? If it’s a server side version of a god-script it may be bypassed.

If it is, you shouldn’t worry about that. unless you have a backdoor in which you’ll need to find and remove.

To test it am using Kohl’s admin.

You shouldn’t worry about it not working for a server-sided admin script, The thing I made is to prevent the exploit version (I tested it myself in studio using the command line)

Unfortunately, as @nulllifeleft pointed out, a client is capable of authoritatively replicating deletions in their character. Not sure if this is a bug or what but this has been reported on several occasions and still presently holds true. The server won’t treat a deleted Humanoid as still-existing.

Evidence

Platform Feedback Search Query:
https://devforum.roblox.com/search?q=delete%20replicate%20category%3A10

Reply I made with links to other posts reporting this problem

It’s an intentional replication behavior, the player-can-delete-anything-in-their-character-and-it’ll-replicate behavior. The reason they can do this is because they are supposed to completely remove their character whenever they die, and I guess Roblox thought it’d be better if clients were responsible for removing their own characters. Probably for reducing the burden on the server or reducing latency or whatever.

Do you have any citation for that? I’m pretty sure the server is responsible for handling that, as they do virtually any other connections by clients to a server or assembling the character in the backend. Only physics and animations (via the Animator object) are supposed to be authoritatively replicated by a client regarding their character and that’s after the server has permitted them to do so.

It seems more like an issue of the workflow rather than server burden. I know that the server would be able to handle such a trivial task without much effort. It’s also why, if you’ve been in a slow-running server, characters don’t respawn for a while but you can still turn your camera around without lag.

I really hope it’s not intentional, because it’s very annoying.

1 Like

Unfortunately no, as Roblox really loves leaving a lot of things undocumented (especially the core stuff). I really only noticed this when instancing a crap ton of parts into my own character (with a server script) and reseting.

The thing is you know that you’re deleting the 50k instances of garbage, because you, yourself end up completely freezing, but everyone else in the game doesn’t experience the same lag and the server isn’t straight up dying.

From that, I put two and two together and just tied the delete-anything-in-character behavior to reseting/dying.

code to test out (run thru command line in dev console):
the reseting behavior (you lag like hell):

for i = 1,50000 do
Instance.new(“Part”,game:GetService"Players"[“NAME”].Character)
end
game:GetService"Players"[“NAME”].Character.Humanoid.Health = 0

having the server delete all this garbage (server lags like hell):

for i = 1,50000 do
Instance.new(“Part”,game:GetService"Players"[“NAME”].Character)
end
game:GetService"Players"[“NAME”].Character:ClearAllChildren()