I made a remote event that whenever you touch a part… You will lose 10 hp. It works, but I am wondering if exploiters can exploit this or is it secure?
--Client-Side:
local dmgPart = game.Workspace.DamagePart
local dmgEvent = game:GetService("ReplicatedStorage").DamageEvent
dmgPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
dmgEvent:FireServer(hit)
end
end)
--Server-Side:
local dmgEvent = game:GetService("ReplicatedStorage").DamageEvent
dmgEvent.OnServerEvent:Connect(function(player, hit)
hit.Parent:FindFirstChild("Humanoid").Health -= 10
end)
I don’t commonly have issues with kill bricks lagging, so damaging on the server is a better way to handle this. Keep in mind exploiters have the ability to use FireServer and could probably spam this event
local dmgPart = script.Parent -- Inside the part
dmgPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local char = hit.Parent
char:WaitForChild('Humanoid').Health -= 10
end
end)
Hackerman changes “Hit” to a in-game players character. U just killed an innocent person.
Hackermans can exploit this, Just leave it on the server in my opinion.
The
.Touched
Event relies on the Clients FPS, The server has a base and tries to maintain a constant heartbeat so this event is fired securely. If a client has like 15 FPS. You aint going to get that .Touched event. So its unreliable depending on the device. - Far fetched but yeah. Just leave it on the server.