Help with a kill to get money script

Hi,

There seems to be something wrong with this script. I get no errors from the output.

--Function call(Values)--
game.Players.PlayerAdded:Connect(function(player)
	--Folder--
	local PlayerStats = Instance.new("Folder") 
	PlayerStats.Name = "PlayerStats"
	PlayerStats.Parent = player
	--Level amount--
	local LevelValue = Instance.new("NumberValue")
	LevelValue.Name = "LevelAmount"
	LevelValue.Parent = PlayerStats
	--Cash amount--
	local CashValue = Instance.new("NumberValue")
	CashValue.Name = "CreditsAmount"
	CashValue.Parent = PlayerStats
	CashValue.Value = 0
	--Function call(Add cash when killed)--
	player.CharacterAdded:Connect(function(Character)
		Character.Humanoid.Died:Connect(function(Died)
			local creator = Character.Humanoid:FindFirstChild("creator")
			local PlayerStats = creator:FindFirstChild("PlayerStats")
			if creator ~= nil and creator.Value ~= nil then
				PlayerStats.CreditsAmount.Value = PlayerStats.CreditsAmount.Value + 500
			end
		end)
	end)
end)

If there nothing wrong with the script then there’s probably something wrong with 5his script thats in the text label that shows the amount of cash.

local player = game.Players.LocalPlayer

player:WaitForChild("PlayerStats").CreditsAmount.Changed:Connect(function(val)
	script.Parent.Text = "Credits: "..val
end)

script.Parent.Text = "Credits: "..player:WaitForChild("CreditsAmount").Value

everything is a server script besides the text label one which is local.

from,
File

When creating a kill script. You must use a “creator tag” why the output is saying is there are no errors, this is because it is giving money to a player which is unknown because the player does not have the “creator tag” value. Right before the “Player.CharacterAdded” function, try typing this:

local Tag = Instance.new("ObjectValue")
Tag.Name = "creator" -- name this whatever you want
Tag.Parent = player
game.Debris:AddItem(Tag, 2) 
Tag.Value = player.Character.Humanoid

what does this line do? I understand everything besides (Tag, 2)

also it doesn’t seem to work. Should the script look like this?

Everything should work. I’m not understanding why it’s not working for you :confused: