I have a script that is in the player, every time he dies, he should check the number of kills of the killer and give him the appropriate inscription above the player. But something is not working. After killing, the inscription above the player does not change.
Here is my script:
local player = script.Parent
local Humanoid = player:WaitForChild("Humanoid")
function Frag()
local Val = Humanoid:FindFirstChild("creator") and Humanoid.creator.Value
if Val then
local leaderstats = Val:FindFirstChild("leaderstats")
leaderstats.Coins.Value = leaderstats.Coins.Value + 15
leaderstats.Kills.Value = leaderstats.Kills.Value + 1
local Players = game:GetService("Players")
Val:Connect(function(char)
local head = char.Head
local lowertext = head.NameTag.LowerText
local humanoid = char.Humanoid
humanoid.DisplayDistanceType = "None"
if Val.leaderstats.Kills.Value <= 1 then
lowertext.Text = "Noob"
lowertext.TextColor3 = Color3.fromRGB(10, 214, 255)
end
if Val.leaderstats.Kills.Value >= 2 then
lowertext.Text = "Pro"
lowertext.TextColor3 = Color3.fromRGB(10, 214, 255)
end
script:Remove()
end)
end
end
Humanoid.Died:connect(Frag)