I was planning on using the default health system to handle the combat for my game. But if players can delete their humanoids, then I should handle all health calculations on server, correct? I also should not store any values in the player’s character and I should have a script in the server that checks if the player has deleted any of their limbs.
Storing values outside of the player’s character is a good idea for preventing possible changes/manipulation by the player. I’d also advise doing a table if you plan to have many values/data on the character as having many instances of data is a bad idea in my opinion though your choice
If you want to make it easy as how you’d change humanoid data by referencing it, you can probably create a module to make it more simpler for you, you can keep it in replicatedstorage since even if the player changes it, it wouldn’t really matter as the actual data/stats is being handled on the server.
You can probably do some .Changed checking on the character like the humanoid or GetPropertyChangedSignal since changes replicate to the server and if the check turns invalid since it changed without any other event occuring, you can just kick/warn/ban (though make sure they’re the right checks)
humanoid.AncestryChanged:Connect(function()
if not(humanoid:IsDescendantOf(game)) and humanoid.Health ~= 0 then
print(plr.Name.." humanoid got destroyed in an invalid manner")
plr:LoadCharacter()
end
end)
I wrote this code will this work how I intend it to stop exploiters from deleting their humanoid?
i probably misread something in that discussion i linked earlier…
but if humanoid gets deleted i dont think it fires the died event which is something my game needs to know when to load characters. at least it didn’t in my test mode. then again that probably doesn’t matter since only an exploiter could delete their own humanoid. I just dont wanna program anything based off the character just in case i make a system that can be broken by exploiters deleting an instance off their character.
Like @QuantixDev said, if an exploiter destroys their own humanoid they’d die and respawn with it again. And yeah, you should avoid storing values in the character. And always do health calculations on the server.
If you’re worried that an exploiter might delete their limbs to escape hitboxes and not get damaged or something like that, you can try this neat trick:
From the server, when a player joins and their character is added, create a hitbox part that fits the character’s bounding box size, and is a cylinder (for better physics), weld it to the player’s HumanoidRootPart, and parent it to workspace.
You can check if an attack hit this hitbox part, because the client does not have ownership over it.
There isn’t much you can do about the player deleting their character’s humanoid. You should try to design your game so that it wouldn’t matter if they did it and I already feel like it wouldn’t really matter.
I’m currently working on a boxing game and I never touch the humanoid at all. If a player decides to delete their own humanoid, they’ll just lose the fight and respawn.
Also, why do you need the Died event to load characters?
I turned off character auto loads because I don’t want to load the player’s character until i’ve gotten their datastore data. I reload the character when the humanoid dies. Is there a better way to do it?
Oh, I see. I’m not sure if there’s a better way to do it but either way if an exploiter deletes their humanoid and their character doesn’t load that’s not your problem, so I wouldn’t worry too much.
Exploiters can delete any descendant of their character and it’ll replicate. I recommend you put important scripts/values in workspace or somewhere other than a player’s character.