How do i secure my remote event?

I think put it in script not local
like put in script if sword touched then it damage

If i do that, all character that touched sword will have damage, it do not fair!

Like which characters do you want to damage?

You mean like you wont know who touched the sword??

Any, but i want player must activate the tool first. then we’ll deal damage he

I used RaycastHitbox to make Touched event

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)

1 Like

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

1 Like

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.

1 Like

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.