Combat Issue/Possible Latency Issue with Hitbox

I would like say now that I’m still beginning to make a combat (Not FPS, more like Encounters if Stun-Lock was a lot more prominent, or similar to aba) . The current issue I’d say I’m dealing with is the way that the hitbox projects itself. As of now I plan to use Region3 (While still trying to figure out how to use EgoMoose’s Module) but the issue at hand to me is trying to even bring the hitbox out properly.
I’ll show a gif then the script.

(https://gyazo.com/e182ea0e078f4efc9ef6d488ebf71838)

script.Parent.OnServerEvent:Connect(function(Player, Action, V1)
	local c = Player.Character
	local RA = c:FindFirstChild("Right Arm")
	local RightArm = c["Right Arm"]
	local LA = c:FindFirstChild("Left Arm")
	local LeftArm = c["Left Arm"]
	if Enabled == false then return end

	if Action == ("Combat") then 
		if Count == 1 then
			Count = 2
			local Anim = Instance.new("Animation")
			Anim.AnimationId = "rbxassetid://7246225588"
			local AnimP = c.Humanoid:LoadAnimation(Anim)
			AnimP:Play()
			HB = game.ReplicatedStorage.Hitbox:Clone()
			HB.Parent = workspace
			Weld.Part0 = HB
			Weld.Part1 = LeftArm
			HB.CFrame = LeftArm.CFrame
			HB.Parent = workspace
			Debris:AddItem(HB, 0.2)
			RR3.FromPart(HB)
			print(RR3.FromPart(HB))	
			wait(0.3)
		elseif Count == 2 then
			Count = 3
			local Anim = Instance.new("Animation")
			Anim.AnimationId = "rbxassetid://7246227343"
			local AnimP = c.Humanoid:LoadAnimation(Anim)
			AnimP:Play()
			wait(0.4)
		elseif Count == 3 then
			Count = 4
			local Anim = Instance.new("Animation")
			Anim.AnimationId = "rbxassetid://7246232053"
			local AnimP = c.Humanoid:LoadAnimation(Anim)
			AnimP:Play()
			wait(0.5)
		elseif Count == 4 then
			Count = 1
			local Anim = Instance.new("Animation")
			Anim.AnimationId = "rbxassetid://7246223838"
			local AnimP = c.Humanoid:LoadAnimation(Anim)
			AnimP:Play()
		end
		wait(0.7)

	end

end)

Remember that each players’ client controls the location of that player’s character. The CFrames of each individual body part will always have latency when read the server. Furthermore, since the network ownership is on that client, it also determines contacts (such as Touched) on that part.

It may be better for your hand-to-hand combat game to register hits on the client, using a LocalScript, and send this information to the server. Then, performs some santity/confidence checks on the information it received to see if the hit is good. You might elect to have the client send which body part hit which other body part, among other information.

1 Like

Wouldn’t an exploiter have some fun with that if I were to allow the hitboxes to get replicated on the client instead?

Also, would this method be similar to a double check, as in you see what is hit first, then check if the hit is able to be confirmed so the Humanoid can take damage?

Yeah, although any latency-compensating hit detection system’s going to be susceptible to a lying client. The idea is that you expect the data sent by the client to be reasonable and verifiable. This depends on that extra data you send from the client. Of course, if you build a system that accepts any old firing of OnServerEvent, you’ll definitely run into problems.

I’d recommend focusing on making a working hit system before a strictly “secure” system.

Alright, I’ll put this method to test and hopefully get results of a working hitbox and relay the results back at a later time. Thank you for your help.

At this point at moving the script, I feel stumped at this point where I should go. Would the next step trying to use RotatedRegion3 to see what I’m hitting or going back to the Local Script to specify what the Hitbox is looking to hit/what it’s hitting?

1 Like

Made a different hitbox and got a friend of mine to help me remake the script.