-
What do you want to achieve? Keep it simple and clear!
I want to add 1 to a value in Players[Killer]. Killer is the value that the Linked Sword gives under Humanoid when it dies. -
What is the issue? Include screenshots / videos if possible!
Attempting to do Players[Killer] results in the following error:
Invalid argument #2 (string expected, got Instance)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I can’t think of any solutions, considering Killer IS a string value, right? I tried to look on the Developer Hub but found no answers pertaining to my specific situation
My code that gives the kills:
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 player = Players[killer]
print(player.Kills.Value)
player.Kills.Value = player.Kills.Value + 1
end
end)
end)
end)