Hi,
I’m having trouble with my hitbox damage having way too much reach or too little reach because of the players ping. If the person with the hitbox has really good ping and the other player has high ping, the other player sees himself being damaged from far away. A good example of this is Basketball Legends. You need to be in your own server location or it won’t be playable at all due to the hitbox issues.
However games like murders vs sheriff duels have lag compensation somehow. How would I do something similar to mvsd?
(serversided)
v.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid") :: Humanoid
if not humanoid then
return
end
local character = hit.Parent
local player = Players:GetPlayerFromCharacter(character)
local killer = Players:GetPlayerFromCharacter(v.Parent.Parent)
if recentlyDamagedCharacters[character] then
return
end
if ReplicatedStorage.Game:GetAttribute("Text") == Settings.RunnerWinStatus then
return
end
if not player then return end
local Damage = v:GetAttribute("Damage") or 0
if player.Team and player.Team == Settings.Green then
recentlyDamagedCharacters[character] = true
Damage += Settings.RangeDamage
humanoid:TakeDamage(Settings.RangeDamage)
local newBlood = Blood:Clone()
for _, instance in pairs(newBlood:GetChildren()) do
local root = player.Character.HumanoidRootPart
if instance:IsA("ParticleEmitter") then
instance = instance :: ParticleEmitter
instance.Parent = root
instance:Emit(instance:GetAttribute("EmitCount"))
end
if instance:IsA("Sound") then
instance = instance :: Sound
PlaySound(instance, root)
end
end
wait(Settings.RangeCooldown)
recentlyDamagedCharacters[character] = nil
end
end)