So i need this but dont know where to start I need to reward the player for killing another player. I dont know how to?
✓ ANSWER ACCEPTED
Is there a way to know who killed a player?
2 answers
✓ Accepted answer
You will need to add this to your tool script : (where the player gets damage)
local tag = Instance.new("StringValue")
tag.Value = KillerName --The name of the player who owns the tool
tag.Name = "creator"
tag.Parent = HitHumanoid --The Humanoid of the player who got damage
game:GetService("Debris"):AddItem(tag,.5)
You will need a script which detects if a player die :
--//Settings\\--
local amt = 1 --//Edit 1 to the number of Points you want to give to the player
local currencyName = "Points" --Change Points to your currency name
--//Script\\--
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
-- Here tag.Value is the player who killed us, so find their leaderstats
local statsKiller = tag.Value:FindFirstChild("leaderstats")
if statsKiller then
-- Award the Points to the player that killed us
statsKiller.Points.Value = statsKiller.Points.Value + amt
end
end
end
end)
end)
end)
ummm i think you can't...
1 comment
2
dont answer if you dont know
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks!