Raycast detection problem

I am trying to make a sword that attacks if u click and the mouse is over the player but it dont work i think this is because when you click it gets the players mouse position on the client then sends it to server, but on the server due to ping the player is in a diffrent location so when it raycasts it does not hit the player, when t he player is standing still the hit detection is perfectly fine its just when people are moving around it is wrong

If your ping isn’t very high, this isn’t going to be that big of a problem, especially if your mouse is perfectly still.
What I am confused about is why you need a mouse raycast for a sword. Is it a thrown sword or just a melee attack?
Can we see your script, by the way?

its like roblox bedwars sword, not like the defualt sword u swing, the problem is because it only lets u hit on the player and 50 ping is enough ping for the player to be in a competly diffrent position on server

i think ik how to fix it ill update you lot if i can fix it

ok so what you do instead of calculating if you hit them on the server you do it on the client but you may wounder isnt this more exploitable, yes but in the server script does all the checks
are they in reach (the main one)
a bit like a anti cheat

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.