Client Ping Issue

My game got issues with the combat in it player’s are getting hit from very far away. But for the monster, he is close to the client but for the client itself, the monster is very far away. Can one of the developers of this forum help me to find a solution?

I tried to use some modules found on the DevForum for instance: ‘ClientCast’ and more but it didn’t work. I tried using raycasting but the problem is probably the clients’ ping mine is always above 200 but when I join a game like Epic Minigames my ping is around 50 - 100. Can somebody please help me I’ve tried a lot of solutions It’s stressing me.

Code I am using right now:

	newKatana.Model.Activated:Connect(function()
		if not Activated then
			Activated = true
			if math.random(1,2) == 1 then
				KatanaAttack1:Play()
			else
				KatanaAttack2:Play()
			end
			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 gameHandler.Wildlings[PlayerName] then
					if (newKatana.Model.Hit.Position - hit.Parent.HumanoidRootPart.Position).Magnitude <= 5 then
						HitDeb = true
						Humanoid:TakeDamage(math.random(minDamage,maxDamage))
						gameHandler.Travelers[Player.Name].killedBy = owner.Name
					end
				end
			end)
			wait(0.5)
			connection:Disconnect()
		end
	end)

Your Melee script seems fine to me, it’s probably something with the script of your monster.

The monster is not a NPC it is a real player

Ok, then don’t call it a monster.

And also, do you have any other scripts in your game, since this is pretty much what I use.
I do not see a problem with this.

Yes I have a game script of course that runs the game

Do you teleport the player anywhere in your scripts, if yes. Use CFrame.

I am using this

p.Character.HumanoidRootPart.CFrame = CFrame.new(m.CurrentMap.Spawn.Position)

Try to do this on a client-side script. This works better and also translates to server-side.

You want me to use a local script instead for my sword?

Please read what I reacted to, try teleporting client-side.
With for example a remote-event

Sorry I just wanted to check up what you really meant since it could be both but thanks let me try!

Alrighty, and if this doesnt work Its probably just your ping.

Well it there a way I can fix ping on my game? Since on a game like Epic Minigames I have a very low ping (60 - 100) and on my game I have 200+ ping all the time.

Try it outside of studio, and in the actual roblox player.

Didn’t fixed anything players with swords can’t hit me