Am I the only one experiencing game latency issues or do more developers experience this?. We’ve got this really weird problem going on which we discovered in other games like Murder Mystery II and other sword-fighting-based games. For the player that holds the sword, he is close to the player that gets hit but for the player that gets hit, it looks like he’s 10 studs away. (The issue doesn’t appear when you’re not moving the sword registers correctly when standing still) I’ve tried researching it on the Devforum, the internet, and other forums but I can’t really find any solutions. We’ve tested it with a brick on a baseplate and connected a touch function to it. It said the player was 10 studs away from the brick and still got hit. You rather say ‘do not use the touch function’ yeah it is an option but it wouldn’t be any better for the player with the sword since it would look hard to hit because the player is actually further away and it will not register. Anyone knows a solution we’ve really tried hard to find a solution by ourselves.
Gif: https://gyazo.com/f965349696b4c45391cf5c60d3178145
Code:
--// SERVICES \\--
local ServerStorage = game:GetService("ServerStorage")
local playersService = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
------------------
--// MAIN \\--
local KatanaHandler = {}
KatanaHandler.__index = KatanaHandler
function KatanaHandler.new(owner, model, minDamage, maxDamage)
local gameHandler = require(script.Parent.GameHandler)
local clientModule = require(replicatedStorage.Modules.ClientModule)
local newKatana = setmetatable({}, KatanaHandler)
newKatana.Model = model:Clone()
newKatana.MinDamage = minDamage
newKatana.MaxDamage = maxDamage
newKatana.Owner = owner
newKatana.Model.Parent = owner.Character
local Activated = false
local HitDeb = false
local Animations = ServerStorage.CloneObjects.Animations
local Humanoid = owner.Character.Humanoid
newKatana.Model.Activated:Connect(function()
if not Activated then
Activated = true
replicatedStorage.RemoteEvents.MainFeatures.KatanaEvent:FireClient(newKatana.Owner)
local connection = newKatana.Model.Hit.Touched:Connect(function(hit)
local Player = playersService:GetPlayerFromCharacter(hit.Parent)
local PlayerName = hit.Parent.Name
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
if Player and not HitDeb and not clientModule.Wildlings[PlayerName] then
print((newKatana.Model.Hit.Position - hit.Parent.HumanoidRootPart.Position).Magnitude)
--if (newKatana.Model.Hit.Position - hit.Parent.HumanoidRootPart.Position).Magnitude <= 3 then
HitDeb = true
Humanoid:TakeDamage(math.random(minDamage,maxDamage))
clientModule.Travelers[Player.Name].killedBy = owner.Name
wait(0.5)
HitDeb = false
--end
end
end)
wait(0.5)
connection:Disconnect()
Activated = false
end
end)
end
return KatanaHandler