Script error occurs but I do not understand why, can someone tell me why this is happening?
Character.Humanoid.Died:Connect(function()
if Character.Humanoid:FindFirstChild("Creator") then
local Creator = Character.Humanoid:FindFirstChild("Creator").Value
if Creator ~= nil then
MaxHealth.Value = MaxHealth.Value - 10
game.Players[Creator].leaderstats.MaxHealth.Value = game.Players[Creator].leaderstats.MaxHealth.Value + 10 -- ( Line that errors )
game.Players[Creator].leaderstats.Kills.Value = game.Players[Creator].leaderstats.Kills.Value + 1
end
end
end)
Creator most likely is an ObjectValue, which stores an instance, the bracket method to get an instance needs the name of the instance to get it. In your case, you may need to replace game.Players[Creator] with Creator