Look when sword activate fire server not dealing damage. Then from server play the animation if there is, and if any player touched the sword while the remote is activated he get damage.
Make ray also in script. If you used ray in local you will need to fire server and let the script know who got touched by the ray.
That mean exploiters will keep firing that remote and let the script know that everyone got touched.
Ok, let me try to use it
then i’ll report the result
Exploiters have something called remoteSpy. They can see every remote fired from client. Like if that remote gives money they can keep firing it for infinity money.
I know about it, but let me try to use your method
Ok, Good luck.,
I have problem now…
How do i know local player?
We can’t use game.Players.LocalPlayer anymore, because this script run on server side.
When the tool is activated fire server, onServerEvent the first argument is player
remote.OnServerEvent:connect(function(plr)
You also can get player from character. When you equip the tool it will be in your character that mean:
local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
What do you mean?
i already use this on my old script
Did i need to get player everytime when player equip item?
I use my own custom solution similar to the Raycast Hitbox module and what I do to verify the hit that works very well is when your attachment hits a character you send the attachment and the part that it hits over to the server, then to verify it you would check if the attachment is a descendant of the sword and you check the distance of the attachment to the instance that it hits, and you would add a cushion to account for lag (My max is 10). Also, you want to add some sort of damage rate limiter, where a character can only be damage after a certain cool down time has elapsed. In addition, you need to track when the character activates the tool on the server and only accept requests while the expected sword activated animation is playing.
Can you show the example? I don’t understand.
Check if attacker near attacked person, to make sure exploiter won’t abuse this remote, also you could try make server-side cooldown.
You said how do I know the local player. I said from the tool.Parent that mean local player character, or from using OnServerEvent. When you use it, The first argument is the local player that the remote got fired from.
EDIT: Also, I told you try to get rid from that line:
dealdamage:FireServer(hit.Parent)
Exploiters easily will use it to kill everyone.
Or you can also use like what @Diltz_3 said check if the attacked person is near the attacker. But still he can fire that remote and kill the near player instantly.
Uhm, but I also said about ss cooldown to prevent from instant killing
I saw debounce in the script, but I don’t really know if he used it. It will be good way to put cooldown inside the script.
I will do not use debounce in script, because if i use it and player attack many character in one time, that mean some event will dropped and it will do not fair with player.
if i use tool.Parent then if tool is on player backpack, or in something that store this tool it will cause error when i trying to do something with player
You didn’t put equip check in local script?
Like when tool equipped and mouse Click it fire the remote.