I have event called "PlayerDiedTo" that is supposted to pass names of things that killed the player to local script so it can check if the thing that killed player was named "CorrectPart"
I tried this but I just started learning about events and dont know how this works
local
local event = game.ReplicatedStorage.PlayerDiedTo
event.OnClientEvent:Connect(function(CorrectPart)
if CorrectPart then
print("Correct")
else
print("False")
end
end)
server
script.Parent.Touched:Connect(function(Hit)
if Hit and Hit.Parent and Hit.Parent:FindFirstChild("Humanoid")then
if Hit.Parent:FindFirstChild("NPC") then --ignore this it just detects if hit parent is not an npc
else
Hit.Parent.Humanoid.Health = 0
local event = game.ReplicatedStorage.PlayerDiedTo
local CorrectPart= script.Parent
event:FireAllClients(CorrectPart)
end
end
end)
