Damage module being delayed in game but not in studio

As the title said,
First heres my code :

function module.DefaultHit(Info)
	local self = setmetatable({}, module
	self.BPD = Info.BypassDefense or 0
	self = Setup(self, Info)
	local Hitbox = MakeHb(Info, true)
	
	local hitchar = {}
	local Victims
	local idk, overlap = Zone(Info, Hitbox.CFrame, Hitbox.Size)
	for i, p in pairs(idk) do
		if p.Parent:FindFirstChild("HumanoidRootPart") and p.Parent.Name ~= Info.Char.Name and not p.Parent:GetAttribute(AvoidAttributes[1]) --[[and accept == false]] and p.Parent:FindFirstChild("Torso") and p.Parent:FindFirstChildOfClass("Humanoid") and not table.find(hitchar, p.Parent) then
			if p.Parent.Humanoid.Health > 0 then
				table.insert(hitchar, p.Parent)
				self.VictimHrp = p.Parent.HumanoidRootPart
				task.spawn(function()
					self.HitStyle = Info.HitStyle 
					if self.HitStyle then
						module:SetHit(self.HitStyle, self.VictimHrp)
					end
				end)
				
				--//Funcs\\--
				
				SetDmg(Info, p, self.BPD, self.cc, self.cd) -- Function that caculate dmg
				AddSound(p.Parent.HumanoidRootPart, Info.Sound)
				CreateVelocity(Info, p) -- Knock back func
				CreateStun(Info, p)
			end
		end
	end
	overlap:AddToFilter(hitchar)
	return self
end

Second:
-the module in the studio works great but in being laggy in game : when the client send the
hit event which is an remote event to the server then to the module which delayed the progress

Any help is appreciated!,
is there anyway to shorten the progress?

If I’m hearing this right, the damage is delayed because the hitbox which is in the client is firing to the server to deal damage?

Well then that’s the reason, RemoteEvents involve Client-Server communication which also involves your ping/latency into account as your network client is communicating to roblox to do something.
The reason why it isnt delayed on Studio is because Roblox Studio servers are ran on the local host. Thus you usually get 0-20 ping on Roblox Studio.

So it basically depends on ur ping ingame

If you wanna see the effect of high ping in Roblox Studio, theres a setting in the Network tab in Studio Settings. Forgot the name tho look it up

1 Like

no

tysm for the idea, ill try to reduce the lag!

wait was it also depend on the data you send through the remote event?