Hello! Below I have my kill script, where Points/EXP is awarded to the player who defeats the other player. What I'd like to do is increase the value of the Points/EXP awarded, by the defeated opponents "Level" on their leaderstats.
example - if player defeats a Level 1 opponent they receive 5 points, if player defeats a Level 2 opponent, they receive 10 points, etc.
Hitting a bit of a wall on that one I've tried adding several different lines, that all seem to result in "is not a valid" with humanoid and the like. Any help suggested would be appreciated. :) Thank you!
The script below works fine, when I add the extra math for the opponent's Level, it goes bad.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
local hum = char:WaitForChild('Humanoid')
hum.Died:connect(function()
local tag = hum:FindFirstChild('creator')
if tag ~= nil then
if tag.Value ~= nil then
local leaderstats = tag.Value:FindFirstChild('leaderstats')
if leaderstats ~= nil then
leaderstats.Points.Value = leaderstats.Points.Value + 5
leaderstats.EXP.Value = leaderstats.EXP.Value + 35
end
end
end
end)
end)
end)

3 comments
Just to clarify: You're asking to increase the amount of points based on they're rank? For example [Rank 1 - 5 Points a kill], [Rank 1 - 10 Points a kill] ?
*Rank 2
Yes! If a player defeats a player at Rank 4, I want them to receive more points than if they defeated someone at Rank 1