I Made a sword for a game and made a local script inside the bladebarrier (Which is a part around the real blade) and i made a script in ServerScriptService and a remote event in replicated storage. Here is the code inside the local script
local event = game.ReplicatedStorage.DamagePLR --- DamagePLR is the remote event
local blade = script.Parent --- the blade barrier
local Damage = 5 --- damage
blade.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
event:FireServer(hit, player.Name, Damage)
end
end)
this is the script
local event = game.ReplicatedStorage.DamagePLR
local da = false ---- debounce
event.OnServerEvent:Connect(function(plr, hit, plrName, dmg)
if not da then
da = true
hit.Parent:FindFirstChild("Humanoid"):TakeDamage(dmg)
print(plrName)
wait(0.5)
da = false
print("Damage Taken!")
end
end)
lets say the player who is holding the sword is player 1 the one getting hit is player 2.
So what is happening is that when player1 hits player2 player2 dies on player 1s screen but on player2s screen he is still alive. How can i fix that? Thanks.

1 comment
It is a glitch, happened to me too