idk, thats what people told me to do. and if you are asking about the sword, this is the classic sword from the roblox toolbox
i think its likned to the player? or humanoid
ObjectValue can be used immediately to store any Instance.
Yes, it’s creating an ObjectValue in the humanoid, and it needs to be checked whether it’s being created in the humanoid in hit
Why are you deleting it after 2 seconds?
I could write you a script, but that will have to be later.
like i said, i didnt maake the sword. it was from the toolbox
the one by roblox
Just check if the ObjectValue is being added to the Humanoid after the hit.
Or you can share the saves so that we can check it ourselves.
Please show what is inside the ‘value’.
Try this, let me know the result
plr.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid then
Humanoid.Died:connect(function()
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value ~= nil then
local Killer = Child.Value
if Killer:IsA("Player") then
local Kill = Killer.leaderstats.Kills
local Times = Killer.leaderstats.Time
Times.Value = Times.Value + plr.leaderstats.Time.Value
Kill.Value += 1
end
end
end
end)
end
end)
Since you only want it to add time when the other player is dead before the damage is dealt check if the player the other player is attacking has less health than the damage the sword does and if so take the player name from the raycast (assuming the sword uses raycast), make a value in them and set it to the name of the player who killed the other player.
No that doesn twork, and the kills arent being added in this script
Try this, show the result
plr.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid then
Humanoid.Died:Connect(function(Hum)
print("Check")
print(Hum)
print(Humanoid:FindFirstChild("creator"))
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value ~= nil then
local Killer = Child.Value
if Killer:IsA("Player") then
local Kill = Killer.leaderstats.Kills
local Times = Killer.leaderstats.Time
Times.Value = Times.Value + plr.leaderstats.Time.Value
Kill.Value += 1
end
end
end
end)
end
end)
Instead of iterating the children of Humanoid, why not just get an instance named “creator” instead.
plr.CharacterAdded:Connect(function(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Humanoid then
Humanoid.Died:Connect(function()
local Tag = Humanoid:WaitForChild("creator", 5)
if Tag then
local Killer = Tag.Value
if Killer:FindFirstChild("leaderstats") and Killer.leaderstats:FindFirstChild("Kills") then
local Kill = Killer.leaderstats.Kills
local Times = Killer.leaderstats.Time
Times.Value += plr.leaderstats.Time.Value
Kill.Value += 1
end
end
end)
end
end)
end)
Killer:IsA(“Player”) doesn’t work as Killer is just a name and has no class.
it doesnt work, kills are being aadded though
if you guys want i can show you the full script?