What I’m trying to do as a security method to prevent exploiters from abusing the fact that the projectiles I’m firing are client sided (hit detection) is to check how many clients are approving the hit is a legitimate one on their client since the projectile has fired on all clients simutaneously. I’m having trouble with making this work out.
Client: basically when the client’s projectile hits a humanoid it sends an event which is the server code below
Serve code:
elseif Word == "ProjectileHitHumanoid" then
local ReportingPlayer = Player
local CasterPlayer = A
local VictimCharacter = B
local Cases = script.Cases
if ReportingPlayer == CasterPlayer then
local ExistingCase = Cases:FindFirstChild(CasterPlayer.Name.."Hit"..VictimCharacter.Name)
if ExistingCase ~= nil then
ExistingCase:Destroy()
local NewCase = Instance.new("NumberValue")
NewCase.Name = CasterPlayer.Name.."Hit"..VictimCharacter.Name
NewCase.Parent = Cases
local Mark = Instance.new("Folder")
Mark.Name = ReportingPlayer.Name
Mark.Parent = NewCase
NewCase.Value = NewCase.Value + 1
else
local NewCase = Instance.new("NumberValue")
NewCase.Name = CasterPlayer.Name.."Hit"..VictimCharacter.Name
NewCase.Parent = Cases
local Mark = Instance.new("Folder")
Mark.Name = ReportingPlayer.Name
Mark.Parent = NewCase
NewCase.Value = NewCase.Value + 1
end
else
local ExistingCase = Cases:WaitForChild(CasterPlayer.Name.."Hit"..VictimCharacter.Name)
if not ExistingCase:FindFirstChild(ReportingPlayer.Name) then
local Mark = Instance.new("Folder")
Mark.Name = ReportingPlayer.Name
Mark.Parent = ExistingCase
ExistingCase.Value = ExistingCase.Value + 1
end
end
local ExistingCase = Cases:FindFirstChild(CasterPlayer.Name.."Hit"..VictimCharacter.Name)
if ExistingCase ~= nil then
local Reporters = ExistingCase:GetChildren()
print(#Reporters)
for i, v in pairs(Reporters) do
print(v.Name)
end
print(#_G.Players:GetPlayers())
if #Reporters >= #_G.Players:GetPlayers() * 0.5 then
if VictimCharacter.Humanoid.Health >= 0 then
VictimCharacter:BreakJoints()
end
end
end
end