Make it so when player2 attempts to damage player1 (with a tool for example), player2 takes damage instead of player1

I want to make it so that if a player is harmed by another player, the other player will take the damage rather than the player who was hit. Like a reflect. I’d assume it’d be something like checking if the player takes damage, but I don’t know how to do that

How do I do that?

1 Like

In the shoot function, make it so it will just take damage on the person firing the gun.

I would also like to see the script.

try to check if player 1 has something that can reflect. Then send data(damage) using some kind of remote event then use that damage to hurt player 2. but lets see the script first

I’m trying to make the script from player 1 rather than a weapon from player 2

Its better to just check if they’re able to be damaged through a module before using TakeDamage and if not then damage themselves
(Doesnt have to be a table module)

Is there a way I can get the player who attacked with lets say a sword for example?

A local script? Try to post the script so i can make a better understanding what what you are trying to do

local player = game.Players.LocalPlayer
local lasthp = 100

player.Character.Humanoid.HealthChanged:Connect(function(health)
if health < lasthp then
--not sure what im supposed to do to find the player who attacked
end
lasthp = health
end)

It’s a local script.

Yes I made a sword that had to check if the enemy was parrying and I used a module table to check.

I used my hitbox client sided and when it hit the enemy it would fire a remote with one argument of the character it hit, using that argument and the default argument of the player who sent the remote I just used a table to check if the person is parrying and if so get the player who attacked with the default remote ( aka plr.Character )

Try using some kind of hitbox to get the player hit that could mean using a module script