Hello, i recently starded roblox game development. I do sanity checks when i request something from local scripts etc., however i have worries about one thing. I have a Humanoid, inside it is a script that detects a player in certain distance and goes up to him. I want to make it so when the Humanoid dies, it drops a random item by using Humanoid.died(). My question is - can scripters manipulate any script inside the Humanoid, or change health or any other property? If not, is it a good idea to call modulescript which contains item drop mechanics on death of the Humanoid, or should i put it elsewhere?
Hello, exploiters can manipulate anything on their client, that includes Humanoids.
However, if the other Player (or NPC?) is on the server and the decision to drop the items is on the server, you should be fine.
The decision to drop the item is inside the script in the Humanoid, that’s why i wonder if the humanoid.Died is server sided or local sided.
humanoid.Died:Connect(function()
--drop item - is this server sided or client sided
end)
It works server side and also client side i think. You can test it if you want
ServerScriptService
If you plan on Securing things, that would be the perfect place to do it.
The Client will be able to see that Script, but in ServerScriptService
they wont
I have a lot of experience with this as long as the died connect function is done on the server side it will be fine. If the local humanoid dying cause the joints break on death then instead of connecting to the humanoid.died state you could instead connect to when the humanoid health<=0 and reenable joints break on death when that condition is met. Also in your code you can do abitrary value updates for the npcs health thus replicating to the client.
Using the humanoid.died connection doesn’t fire when the humanoid parent walks off the map into the abyss. You should know this for future development.
Thanks, i just remembered that i can run commands as a client from studio, tried changing Attributes, changing health and none of that matters since its only visible on the client that changed it. Thanks for the void tip too
Yeah I had to use this method in my game because enemies spawn from a portal and when they die they need to tell the portal that they have died because when the portal is defeated you can close it.
I would reccomend using both methods. I would connect via
local Death=false
function HumDead()
if Death==false then
Death=true
end
end
Humanoid:GetPropertyChangedSignal(“Health”):Connect(function()
if Humanoid.Health=<0 then
task.wait(.05)–just in case they fire at the same time
HumDead()
end
end)
Humanoid.Died:Connect(function()
HumDead()
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.