I was fiddling around FMK (Fe melee kit) to see if it has any securities, turns out it did a simple distance check, however i was wondering if their way to distance check is reliable or not.
--TARGET IS CHARACTER GETTING HIT
-- PLAYERCHAR IS THE ORIGINAL CHARACTER HITTING TARGET
local MaxDistance
local DistanceFromTarget
local TargetCentre = Target:FindFirstChild("Torso") or Target:FindFirstChild("HumanoidRootPart")
if WeaponTags.SafeHitbox and TargetCentre then
local TargetTorsoPos = TargetCentre.Position
local PlayerCharTorsoPos = (Tool:FindFirstChild("Handle2") and ATHandle == "Handle2") and Tool.Handle2:FindFirstChild("AttachmentTop").WorldPosition or Handle:FindFirstChild("AttachmentTop").WorldPosition
local AttachmentTopPos = (Tool:FindFirstChild("Handle2") and ATHandle == "Handle2") and Tool.Handle2:FindFirstChild("AttachmentTop").WorldPosition or Handle:FindFirstChild("AttachmentTop").WorldPosition
local AttachmentBottomPos = (Tool:FindFirstChild("Handle2") and ATHandle == "Handle2") and Tool.Handle2:FindFirstChild("AttachmentBottom").WorldPosition or Handle:FindFirstChild("AttachmentBottom").WorldPosition
--
local TargetRay = Ray.new(PlayerCharTorsoPos, (TargetCentre.Position - PlayerCharTorsoPos).unit * 300)
local PartHit, PartPos = workspace:FindPartOnRay(TargetRay, PlayerCharacter)
--
if PartHit and PartHit.Parent:FindFirstChildOfClass("Humanoid") == nil then return end
--
local Allow = true
local Allow2 = true
--
-- if VisualSettings.DebuggingInstances == true then
-- local function NewPart(position) local Part = Instance.new("Part") Part.Anchored = true; Part.Size = Vector3.new(0.5,0.5,0.5) Part.CanCollide = false Part.Position = position Part.Parent = workspace end
-- NewPart(PlayerCharTorsoPos); NewPart(PartPos)
-- end
--
DistanceFromTarget = (PlayerCharTorsoPos - PartPos).magnitude
MaxDistance = (AttachmentBottomPos - AttachmentTopPos).magnitude
logwarn((MaxDistance + 1 + WeaponTags.SafeHitRange).." // "..DistanceFromTarget)
end
--
if WeaponTags.SafeHitbox and (MaxDistance + 1 + WeaponTags.SafeHitRange) < DistanceFromTarget then AttackServerBasicPass = false; return end