To keep it simple, this script I made shows the characters level above their head. And yes I know I've set it to update every time the player dies because thats how I want it to work. But the thing is, say a player is level 3 and another 2 players are level 1. When those two players die they both show level 3 above their heads. It's pretty much taking the highest players level and showing it above everyone.
Is there any simple way around this?
Thanks in advance for help!
function CharacterRemoving(newPlayer) wait(1) while true do wait(0.1) if xp.Value >= 100 then levels.Value = levels.Value + 1 xp.Value = 0 end gui=Instance.new("BillboardGui") gui.Parent=newPlayer.Character.Head gui.Adornee=newPlayer.Character.Head gui.Size=UDim2.new(3,0,2,0) gui.StudsOffset=Vector3.new(0,2,0) text=Instance.new("TextLabel") text.Text = "Level " .. levels.Value text.Size=UDim2.new(1.25,0,0.5,0) text.Position=UDim2.new(-0.125,0,-0.25,0) text.BackgroundTransparency = 1 text.Parent=gui text.FontSize = ("Size36") text.Font = ("ArialBold") text.TextColor3 = Color3.new(255, 255, 0) text.TextStrokeColor3 = Color3.new(0, 0, 0) text.TextStrokeTransparency = 0 w = game.Lighting.WepsGroup:GetChildren() for i = 1,#w do w[i]:Clone().Parent = newPlayer.Backpack end end end function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then CharacterRemoving(newPlayer)
Assuming this isn't your whole script, the problem is your xp
and levels
variable. You never had them reset each time a character dies. So, at the beginning of the function, line 2, set both of those values correctly, by accessing wherever it is. For example, if their xp values were leaderstats, have it access the Player's leaderstats, and proceed with your code.