Script doesn't function as intended

Script error occurs but I do not understand why, can someone tell me why this is happening?

image

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)

copy line 41 and post it here!!!

I have already posted line 41 and the piece of code it is affiliated with.

game.Players[Creator].leaderstats.MaxHealth.Value = game.Players[Creator].leaderstats.MaxHealth.Value + 10

Creator must be set to a instance and its expecting a string

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

1 Like