Hello, so I'm currently making a script that prints out
- Killer Name
- Killer Weapon
Whenever I go to test it I get an error in my output saying Workspace.Script:12: attempt to index local 'Weapon' (a nil value) How would I go about fixing this? Here's my full script
Players = game:GetService("Players")
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
if Humanoid:FindFirstChild("creator") ~= nil then
local Killer = Humanoid.creator.Value
local Weapon = Killer:FindFirstChildOfClass("Tool") if true then
end
print (Killer.Name)
print (Weapon.Name)
end
end)
end)
end)

1 comment
When it posts that something is nil, that means there is no value with it... a good example being if it's suppose to show the weapon that killed it, it most likely wasn't able to read the tools name.