So I am new to scripting and am using this model for the overhead gui. I’m trying to modify it so that when a player reaches a certain amount of exp, they get a title, but the code won’t run.
Script:
local rep = game:GetService("ServerStorage")
local nametag = rep.NameTag
--Functions
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
--Varibles
local head = char.Head
local newtext = nametag:Clone()
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
local humanoid = char.Humanoid
humanoid.DisplayDistanceType = "None"
--Main Text
newtext.Parent = head
newtext.Adornee = head
uppertext.Text = player.Name
-- Exp Title (this part won't work)
local exp = player.leaderstats.Exp.Value
if exp >= 0 then
lowertext.Text = "Newbie (I) | 0+ exp"
lowertext.TextColor3 = Color3.fromRGB(171, 171, 171)
print("Gave Newbie (I)")
end
if exp >= 25 then
lowertext.Text = "Newbie (II) | 25+ exp"
lowertext.TextColor3 = Color3.fromRGB(171, 171, 171)
print("Gave Newbie (II)")
end
if exp >= 50 then
lowertext.Text = "Newbie (III) | 50+ exp"
lowertext.TextColor3 = Color3.fromRGB(171, 171, 171)
print("Gave Newbie (III)")
end
end)
end)
I’ve tried swapping exp
with the value, ie if 0 >= exp then
. This time it did display, but didn’t give me the correct title. It ran all the code and gave me the highest possible title when I didn’t have the required exp. For example, if I had 10 exp, it gave me “Newbie (III) | 50+ exp” instead of “Newbie (I) | 0+ exp”
Any help is appreciated. Thanks in advance!