Hello
-
What do you want to achieve? I want to get the tool used in the kill for a killfeed system im using (creator tag)
-
What is the issue? fails to get tool always ends up with attempt to concatenate stirng with nil
-
What solutions have you tried so far? I looked up and tryed adding .Name at the end but it didnt work
ServerScriptService Script
local killedEvent = game.ReplicatedStorage.KilledEvent
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").Died:Connect(function(killed)
local killer = char.Humanoid:FindFirstChild("creator")
local KillerTool = nil
if killer and killer.Value then
local KillerName = killer.Value
for _, Tool in pairs(killer:GetChildren()) do
if Tool:IsA("Tool") then
KillerTool = Tool
end
end
killedEvent:FireAllClients(plr, KillerName, KillerTool)
end
end)
end)
end)
LocalScript within a GUI
local KilledEvent = game.ReplicatedStorage.KilledEvent
local TextLabel = script.TextLabel
local words = {"💥","🎯","💀","⚔️"}
KilledEvent.OnClientEvent:Connect(function(plr, KillerName, KillerTool)
if plr and KillerName then
local newLabel = TextLabel:Clone()
newLabel.Text = words[math.random(1,#words)].." "..KillerName.Name.." killed "..plr.Name.." with "..KillerTool
newLabel.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui").KillFeed.Frame
wait(5)
newLabel.Transparency = 0.1
wait(0.1)
newLabel.Transparency = 0.2
wait(0.1)
newLabel.Transparency = 0.3
wait(0.1)
newLabel.Transparency = 0.4
wait(0.1)
newLabel.Transparency = 0.5
wait(0.1)
newLabel.Transparency = 0.6
wait(0.1)
newLabel.Transparency = 0.7
wait(0.1)
newLabel.Transparency = 0.8
wait(0.1)
newLabel.Transparency = 0.9
wait(0.1)
newLabel.Transparency = 1
wait(0.1)
newLabel:Destroy()
end
end)