I’m working on a kill feed for the classic linked sword.
When I try to pass the kill message from a local script to a script using a remote event, the script just prints the player’s name instead of the kill message. I don’t think it’s receiving the kill message.
StarterPlayer>StarterPlayerScripts>LocalScript
local player = game.Players.LocalPlayer
local function onCharacterAdded(char)
local humanoid = char:WaitForChild("Humanoid")
local function onDeath()
local tag = humanoid:FindFirstChild('creator')
if tag and tag.Value then
local distance = (char.HumanoidRootPart.Position - tag.Value.Character.HumanoidRootPart.Position).Magnitude
local rounded = math.round(distance * 10) / 10
local DeathMSG = player.Name .. ' was killed by ' .. tag.Value.Name .. ' ' .. rounded .. ' studs away.'
print(DeathMSG)
game.ReplicatedStorage.KillFeedEvent:FireServer(DeathMSG)
end
end
humanoid.Died:Connect(onDeath)
end
player.CharacterAdded:Connect(onCharacterAdded)
ServerScriptService>Script
game.ReplicatedStorage.KillFeedEvent.OnServerEvent:Connect(function(DeathMSG)
print("RemoteEvent connected! Printing DeathMSG next.")
print(DeathMSG)
end)