I'm trying to make a script for a UI that changes an icon dependent on a person's level. I get no output and no errors. I've tried deducting numbers to get the rbxasset and still nothing has worked.
Error happens on line 50 from then on.
wait()
_C = require( game:GetService("ReplicatedStorage").GameConfig )
_I = require( game:GetService("ReplicatedStorage").RankImgVariables )
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local hum = chr:WaitForChild("Humanoid",10)
lstats = plr:WaitForChild("leaderstats")
lvl = lstats:WaitForChild("Level")
exp = lstats:WaitForChild("XP")
gol = lstats:WaitForChild("Gold")
function addComas(str)
return #str % 3 == 0 and str:reverse():gsub("(%d%d%d)", "%1,"):reverse():sub(2) or str:reverse():gsub("(%d%d%d)", "%1,"):reverse()
end
spawn(function()
while wait() do
if workspace:WaitForChild("PlayerHolder"):FindFirstChild(plr.Name) then
chr = workspace:WaitForChild("PlayerHolder"):FindFirstChild(plr.Name) -- To update the character.
hum = chr:WaitForChild("Humanoid")
end
end
end)
pcall(function()
for _,v in ipairs(script:GetDescendants()) do
if v.Name == "Color" then
v.BackgroundColor3 = _C.UI_Color
elseif v:IsA("TextButton") and v.BorderSizePixel > 0 then
v.BorderColor3 = _C.UI_Color
elseif v.Name == "PlayerImage" then
v.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..plr.UserId.."&width=420&height=420&format=png"
elseif v.Name == "PlayerName" then
v.Text = string.upper(plr.Name)
elseif v.Name == "PlayerLevel" then
pcall(function() lvl.Changed:Connect(function() v.Text = "> "..addComas(tostring(lvl.Value)) end) end)
v.Text = "> "..addComas(tostring(lvl.Value))
elseif v.Name == "PlayerEXP" then
pcall(function() exp.Changed:Connect(function() v.Text = "> "..addComas(tostring(exp.Value)).."/"..addComas(tostring(lvl.Value*25)) end) end)
v.Text = "> "..addComas(tostring(exp.Value)).."/"..addComas(tostring(lvl.Value*250))
elseif v.Name == "PlayerGold" then
pcall(function() gol.Changed:Connect(function() v.Text = "> "..addComas(tostring(gol.Value)) end) end)
v.Text = "> "..addComas(tostring(gol.Value))
elseif v.Name == "PlayerSpeed" then
pcall(function() hum:GetPropertyChangedSignal("WalkSpeed"):Connect(function() v.Text = "> "..hum.WalkSpeed.."/99" end) end)
v.Text = "> "..hum.WalkSpeed.."/99"
elseif v.Name == "LevelIcon" then
pcall(function() lvl.Changed:Connect(function()
if lvl.Value == 1 then
v.LevelIcon.Image = "rbxassetid://2468821787"
elseif lvl.Value == 2 then
v.LevelIcon.Image = "rbxassetid://2468821787"
elseif lvl.Value == 3 then
v.LevelIcon.Image = "rbxassetid://2468821787"
elseif lvl.Value == 4 then
v.LevelIcon.Image = "rbxassetid://2468821787"
elseif lvl.Value == 5 then
v.LevelIcon.Image = "rbxassetid://2468821787"
elseif lvl.Value == 6 then
v.LevelIcon.Image = "rbxassetid://2468821787"
else
print("User is not a level")
end end) end)
end
end
end)
for _,v in pairs(script:FindFirstChild(_C.UI_Theme):GetChildren()) do
v.Parent = script.Parent
end

7 comments
You said no output and errors but error on line 50...do you mean the script just isn’t working from line 50+?
What exactly is “Level Icon”?
Level Icon is an Image Label. I just renamed it sorry for not mentioning that. And yes; the script isn't working from line 50+. My apologies for not explaining that.
The main issue was that it's not changing the image/icon
why would you have LevelIcon.LevelIcon
btw wrapping everything in pcalls just means it won't error so you don't want those there if you're testing to see if you code works
I changed it to v.Image and again still doesn't work. But props for noticing that issue. I also tried putting prints through each one; and it doesn't even detect the persons rank