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
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
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)
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)
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 )