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?
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.
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.
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.