Billboard DataStorage issues

Hi! This message appeared in the output, I would like to know what I am doing wrong, could someone give me a hand? :frowning:

image

Server script:

local DS = game:GetService("DataStoreService")
local Datastore = DS:GetDataStore("MyDatastore")

game.Players.PlayerAdded:Connect(function(player)
	local Char = player.Character or player.CharacterAdded:Wait()

	local BillboardGUI = Instance.new('BillboardGui')
	BillboardGUI.Name = 'Billboard'
	BillboardGUI.Size = UDim2.new(3, 0, 1, 0)
	BillboardGUI.StudsOffset = Vector3.new(0, 2, 0) -- change the number 2 to make it go higher or lower
	BillboardGUI.Parent = Char.Head

	local TextLabel = Instance.new("TextLabel")
	TextLabel.Size = UDim2.new(1,0,1,0)
	TextLabel.Name = "TextLabel"
	TextLabel.TextScaled = true
	TextLabel.Parent = BillboardGUI

	print("BillboardGUI Given to "..player.Name)

	-- BillboardData
	local Data

	local success, errormessage = pcall(function()
		Data = Datastore:GetAsync(player.UserId)
	end)

	if success then
		print("Loaded "..player.Name)
		if Data ~= nil then
			print(player.Name.." has saved data")
			TextLabel.Text = Data.Billboardtext
		else -- If the Player is new
			print(player.Name.." doesn't have saved data")
			TextLabel.Text = "NEW PLAYER"
			TextLabel.TextColor3 = Color3.fromRGB(255, 238, 245)
			TextLabel.TextStrokeTransparency = 1 -- can be change (el contorno)
			TextLabel.BackgroundTransparency = 1
		end
	else
		warn(errormessage)
		print("In the data is something wrong.")
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	local Data = {
		BillboardText = player.Character.Billboard.TextLabel.Text
	}
	local success, errormessage = pcall(function()
		Datastore:SetAsync(player.UserId, Data)
	end)
	if success then
		print("Saved "..player.Name)
	else
		print("Error saving "..player.Name)
	end
end)

You parent the billboard to the character’s head and then try to get it as if it’s parented to the character model

1 Like

Oh so there is nothing wrong with that message on the output?

No it’s telling you that it can’t find anything in the character model, you parented the billboard to the head

Should be

local Data = {
	BillboardText = player.Character.Head.Billboard.TextLabel.Text
}
1 Like

Thank you so much, that worked for me!

@EmbatTheHybrid a question
with textscaled activated, how can I modify the size of the text? or is there a way to resize and make the text keep its size and position when i do zoom-in and zoom-out?

I am looking to make the text look something similar to this image:

image

As you can see the text looks very different…