Hey I have this script inside another function, connected to the PlayerAdded event:
local gui = game.ServerStorage.RankGui
player.CharacterAdded:Connect(function(character)
local clone = gui:Clone()
clone.Parent = character:WaitForChild("Head")
end)
which works fine when I leave it like that. However, when I change it to this:
local gui = game.ServerStorage.RankGui
player.CharacterAdded:Connect(function(character)
local clone = gui:Clone()
clone.TextLabel.Text = title.Value
clone.Parent = character:WaitForChild("Head")
end)
where title is a previously-defined string value, the billboard gui disappears. How can I fix this and have the text be the string value?
EDIT: I played around with the function a little and found out that this part of the script wasn't the issue. Here's the full script:
local dss = game:GetService("DataStoreService")
local DataStore = dss:GetDataStore("ElfLevels")
-- set up leaderstats
game.Players.PlayerAdded:Connect(function(player)
local Leaderstats = Instance.new("Folder", player)
Leaderstats.Name = "leaderstats"
local Stat = Instance.new("Folder", player)
Stat.Name = "ElfStats"
local level = Instance.new("IntValue", Leaderstats)
level.Name = "Level"
level.Value = 1
local presentsCompleted = Instance.new("IntValue", Leaderstats)
presentsCompleted.Name = "Presents Completed"
presentsCompleted.Value = 0
local title = Instance.new("StringValue", Stat)
title.Name = "Title"
title.Value = "Trainee Elf"
local money = Instance.new("IntValue", Stat)
money.Name = "Money"
money.Value = 0
local Data = DataStore:GetAsync(player.UserId)
if Data then
level.Value = Data.level
presentsCompleted.Value = Data.presents
title.Value = Data.title
money.Value = Data.money
end
local gui = game.ServerStorage.RankGui
player.CharacterAdded:Connect(function(character)
local clone = gui:Clone()
clone.TextLabel.Text = title.Value
clone.Parent = character:WaitForChild("Head")
end)
end)

2 comments
I'm no good at UI coding but you could just instead of cloning, make the textlabel in the script. (With the XY, settings etc)
okay I'll try that real quick