This isn't just a ping issue. I know most sword games have ping issues where someone 2 studs away is actually closer on the server side. This spans WAY larger, and its odd because only one of my three swords has this issue. All three of the swords are almost exactly the same, with their special being the difference. When someone swings this bad boy, someone 10 studs away can take damage.

Inside a part of the sword named "blade": (Please excuse my weird variable names)

local swang = script.Parent.Parent:WaitForChild("swang")
local lange = script.Parent.Parent:WaitForChild("lange")
local swing = script.Parent.Parent:WaitForChild("swing")
local lunge = script.Parent.Parent:WaitForChild("lunge")
local done = script.Parent.Parent:WaitForChild("done")
local players = {}
local cooldown = false
local damage = script.Parent.Parent.damage.Value
local ouch = script.Parent:WaitForChild("ouch")
lange.OnServerEvent:connect(function()
	
	lunge.Value = true
	
	wait(.6)
	
	script.Parent.Trail.Enabled = false
	lunge.Value = false
	
	wait(7) -- lunge cooldown
	
	script.Parent.Trail.Enabled = true
end)
done.OnServerEvent:connect(function()
	print("detected")
	cooldown = false
	for i, v in pairs(players) do
		table.remove(players, i)
	print("deleted")
	end
end)
swang.OnServerEvent:connect(function()
	swing.Value = true
	
	
end)
done.OnServerEvent:connect(function()
	swing.Value = false
end)

function onTouched(hit)
	local human = hit.Parent:FindFirstChild("Humanoid") 
        
	if (human ~= nil) then 
		print("human")
		
		if lunge.Value == true or swing.Value == true then
			
			local name = hit.Parent.Name
			for i, v in pairs(players) do
				if v == name then
					cooldown = true
				end
			end
			if cooldown == false then
			cooldown = true
			table.insert(players, name)
		human.Health = human.Health - damage
		ouch:Play()
		cooldown = false
		if lunge.Value == true then
			local helth = script.Parent.Parent.Parent:WaitForChild("Humanoid")
			if helth then
			helth.Health = helth.Health + damage
			print ("bacc")
			end
		end
			end
		end
	end
end



if (script.Parent ~= nil) and (script.Parent.className == "Part") then 
	connection = script.Parent.Touched:connect(onTouched)
end

2 comments

0

sometimes meshes have wierd hitboxes, you should maybe chek that

0

The blade is not a mesh, it's a part welded to the sword.