ddenyz
(wdenyz)
June 28, 2023, 8:04pm
#1
idk what is happening but image labels not updating
local function addRankIcon(player, rank)
if rank == "Competente" then
-- OWNER ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
elseif rank == "Especialista" then
-- DEV ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
end
end
1 Like
ikDebris
(ikDebris)
June 28, 2023, 8:13pm
#2
if rank == "Competente" then
-- Set the image for the "Competente" rank
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
local image = guiClone:FindFirstChild("Image")
image.Image = "rbxassetid://5436304966"
elseif rank == "Especialista" then
-- Set the image for the "Especialista" rank
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
local image = guiClone:FindFirstChild("Image")
image.Image = "rbxassetid://5436304966"
end
ddenyz
(wdenyz)
June 28, 2023, 8:17pm
#4
tried it and It still does not work
ikDebris
(ikDebris)
June 28, 2023, 8:19pm
#5
Can you send the whole code?
And is the rank == “Especialista” an actual rank in a group or just a username.
ddenyz
(wdenyz)
June 28, 2023, 8:20pm
#6
it’s leaderstats rank:
local gui = game.ReplicatedStorage:FindFirstChild("ImageGui")
local image = gui.ImageLabel
game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
ls.Parent = plr
local winsValue = Instance.new("IntValue")
winsValue.Name = "Wins"
winsValue.Parent = ls
local rankValue = Instance.new("StringValue")
rankValue.Name = "Rank"
rankValue.Parent = ls
local function updateRank(wins)
if wins >= 400 then
rankValue.Value = "Aether"
elseif wins >= 300 then
rankValue.Value = "Divino"
elseif wins >= 200 then
rankValue.Value = "Imortal"
elseif wins >= 150 then
rankValue.Value = "Supremo Lendário"
elseif wins >= 100 then
rankValue.Value = "Supremo"
elseif wins >= 80 then
rankValue.Value = "Lendário"
elseif wins >= 65 then
rankValue.Value = "Mestre"
elseif wins >= 50 then
rankValue.Value = "Destemido"
elseif wins >= 35 then
rankValue.Value = "Experiente"
elseif wins >= 5 then
rankValue.Value = "Especialista"
elseif wins >= 1 then
rankValue.Value = "Competente"
else
rankValue.Value = "Iniciante"
end
end
local function addRankIcon(player, rank)
if rank == "Competente" then
-- OWNER ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
elseif rank == "Especialista" then
-- DEV ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
end
end
local success, data = pcall(function()
return winsDataStore:GetAsync(plr.UserId .. "-Wins")
end)
if success then
local winsData = data or 0
winsValue.Value = winsData
updateRank(winsData)
addRankIcon(plr, rankValue.Value)
print("Dados carregados para " .. plr.Name)
else
warn("Dados não carregados para " .. plr.Name)
local failedToLoad = Instance.new("StringValue")
failedToLoad.Name = "ERRO AO SALVAR DADOS"
failedToLoad.Value = "Erro ao carregar dados"
failedToLoad.Parent = plr
end
end)
ikDebris
(ikDebris)
June 28, 2023, 8:23pm
#7
local gui = game.ReplicatedStorage:FindFirstChild("ImageGui")
local image = gui.ImageLabel
local winsDataStore = --edit
game.Players.PlayerAdded:Connect(function(plr)
local ls = Instance.new("Folder")
ls.Name = "leaderstats"
ls.Parent = plr
local winsValue = Instance.new("IntValue")
winsValue.Name = "Wins"
winsValue.Parent = ls
local rankValue = Instance.new("StringValue")
rankValue.Name = "Rank"
rankValue.Parent = ls
local function updateRank(wins)
if wins >= 400 then
rankValue.Value = "Aether"
elseif wins >= 300 then
rankValue.Value = "Divino"
elseif wins >= 200 then
rankValue.Value = "Imortal"
elseif wins >= 150 then
rankValue.Value = "Supremo Lendário"
elseif wins >= 100 then
rankValue.Value = "Supremo"
elseif wins >= 80 then
rankValue.Value = "Lendário"
elseif wins >= 65 then
rankValue.Value = "Mestre"
elseif wins >= 50 then
rankValue.Value = "Destemido"
elseif wins >= 35 then
rankValue.Value = "Experiente"
elseif wins >= 5 then
rankValue.Value = "Especialista"
elseif wins >= 1 then
rankValue.Value = "Competente"
else
rankValue.Value = "Iniciante"
end
end
local function addRankIcon(player, rank)
if rank == "Competente" then
-- OWNER ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
elseif rank == "Especialista" then
-- DEV ICON OVERHEAD
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = player.Character.Head
guiClone.Adornee = player.Character.Head
image.Image = "rbxassetid://5436304966"
end
end
local success, data = pcall(function()
return winsDataStore:GetAsync(plr.UserId .. "-Wins")
end)
if success then
local winsData = data or 0
winsValue.Value = winsData
updateRank(winsData)
addRankIcon(plr, rankValue.Value)
print("Dados carregados para " .. plr.Name)
else
warn("Dados não carregados para " .. plr.Name)
local failedToLoad = Instance.new("StringValue")
failedToLoad.Name = "ERRO AO SALVAR DADOS"
failedToLoad.Value = "Erro ao carregar dados"
failedToLoad.Parent = plr
end
end)
ddenyz
(wdenyz)
June 28, 2023, 8:28pm
#8
tried again and nope didnt work
ikDebris
(ikDebris)
June 28, 2023, 8:41pm
#9
What error is given to you when you run the game?
ddenyz
(wdenyz)
June 28, 2023, 8:44pm
#10
fixed it, this what i did:
local function addRankIcon(wins)
if wins >= 5 then
-- OWNER ICON OVERHEAD
image.Image = "rbxassetid://9326125034"
elseif wins >= 1 then
-- DEV ICON OVERHEAD
image.Image = "rbxassetid://115530144"
end
local guiClone = gui:Clone()
guiClone.Enabled = true
guiClone.Parent = plr.Character.Head
guiClone.Adornee = plr.Character.Head
end
addRankIcon(winsData)
1 Like
system
(system)
Closed
July 12, 2023, 8:44pm
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.