Kill for cash using only gui is not working

Incase if this was not the problem, here is a separate script on the classic sword:
local hitbox = -- part that hits playres

hitbox.Touched:Connect(function(hitPart)
	local hitChar = hitPart:FindFirstAncestorOfClass("Model") -- get the character model that was hit
	local char = hitbox:FindFirstAncestorOfClass("Model") -- get the character of the player holding the sword, you can use this because the tool is moved into the player character when it is equipped

	if not hitChar:FindFirstChild("Humanoid") then
	return
end

	local hitPlayer = game.Players:GetPlayerFromCharacter(hitChar) -- get the hitted player instance
	local player = game.Players:GetPlayerFromCharacter(char)

	hitPlayer.Killer.Value = player -- even if the player doesn't die set the killer so that you can know who killed the player once they die
end)

This will maybe help you more, I am so close to the solution, but it might take a while to do so.

There is quite a lot to read, I have a general idea of what you’re trying to accomplish. Since you’re trying to use GUIs and outdated sword scripts, can you send a copy of the game (with just the relevant scripts) to make it a bit easier?

Im not sure if I can copy the game but I could try to if I know how to.

back online for only 2 more days so anyone want to help me out the solution please?

replying this 2nd time sorry if it bothers you.

3rd time again sorry. The only reason why I keep doing this is to finish a problem and find an easier solution I can do.

There is many tutorials on YouTube.

well I looked it up and found nothing that relates to this. Kinda useless but ty for trying at least.

Anyone else want to try to help me? I am a bit stuck, but I know what I am trying to do.

I’ll give it a shot … #1 the word “stats” is a saved word and you shouldn’t use it. If you type in a word and it comes up blue in the editor, with no refference to it at all, it’s a saved word/command.

Go get this sword ← the link to it
I think it may even be the one you were using … it has the tag stuff we need
This is the function we need.

function TagHumanoid(humanoid, player)
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.Value = player
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

You will need to add that function to your sword script … but NOT now. For now, just use that sword to test with. Now you have the sword I just linked to you in StarterPack and in ServerScriptService drop this script. It should fit your game set up. If you use a different sword then add that function to it.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Statz = Instance.new("Folder") Statz.Name = "Statz" Statz.Parent = Player
		local pMoney = Instance.new("IntValue") pMoney.Name = "Money" pMoney.Value = 20
		pMoney.Parent = Statz 
		
		Character.Humanoid.Died:Connect(function()
			if Character.Humanoid:FindFirstChild("creator") then
				local Player = Character.Humanoid.creator.Value
				local kMoney = Player.Statz.Money
				kMoney.Value += pMoney.Value
			end
		end)
	end)
end)

As for a possible Gui for this … (right click on StarterGui and insert from file)
MoneyGui.rbxm (4.6 KB) … Just a quick script and not very secure.

The update on the Gui can be taken care of in that Gui with a onchange update targeted on the player money value. Also I took it you wanted to get all the money that player had from killing other players.

I copied the code and putted it in but now I have an error message on the part called Debris. Should I do local or not?

Debris has nothing to do with that script … It is not a local script. A normal script in ServerScriptService. The script however only updates the value of money and does not update the Gui at all. That should be taken care of in the Gui itself.

Alright im going to get my friend to see if it works. Ill mark as solution if it works.

I played with my friend. It didnt work. Not only the text is gone, but the system is not working too.

That’s unfortunate. In my tests it worked fine. This script also has nothing to do with the Text showing in anyway or Debris as you also stated. These things sound like different errors.

yeah. The text is needed to be shown up. For example, some combat games. they use text to show how much money they get per kill.

I updated the other post with a possible Gui.

sorry for the delay but I will work on it tomorrow. I was too busy so I can’t focus on this a lot.

Nvm there isnt other way bc almost every game uses leaderboards to show their cash .