Trouble converting font into string value

Hi! A game I’m working on has a nickname selection screen that allows players to choose their nickname, color as it appears, and font (the color and font will appear on an overhead gui). To do this, I have been getting the data from the gui with a remote event, then taking that data and creating a folder of values in the player. This method has been working for both the nickname text and the color selected, but when the string value is created for the font type, there is no value.
Here is the local script text in the submit button:

local remoteEvent = game.ReplicatedStorage.ClientToServer.NicknameChosen
local box = script.Parent.Parent.TextBox
local button = script.Parent
local colorSelection = script.Parent.Parent.Colors.Selection

button.Activated:Connect(function()
	local text = box.Text
	
	remoteEvent:FireServer(text, colorSelection.BorderColor3, box.Font)
	print("Sent")
end)

And here is the part of a script in server script service that receives the event:

client.NicknameChosen.OnServerEvent:Connect(function(player, name, color, font)
	local nameItems = Instance.new("Folder", player)
	nameItems.Name = "NameItems"

	local nickname = Instance.new("StringValue", nameItems)
	nickname.Name = "Nickname"
	nickname.Value = name

	local ncolor = Instance.new("Color3Value", nameItems)
	ncolor.Name = "Color"
	ncolor.Value = color

	local namefont = Instance.new("StringValue", nameItems)
	namefont.Name = "Font"
	namefont.Value = font

end)

It gives me the error:

09:27:05.907 ServerScriptService.Main:27: invalid argument #3 (string expected, got EnumItem) - Server - Main:27

How can I send the font value, either as a string value or as something else so that I can use it to create the overhead gui?

try using tostring()

local nickname = Instance.new("StringValue", nameItems)
nickname.Name = "Nickname"
nickname.Value = tostring(name)

have a good day

1 Like

change namefont.Value = font to namefont.Value = font.Name because assuming font is a font type for the box it is a enum not a string

An Enum contains a property called Name which basically is the name of the Enum in string. So if the Enum is a Font, then the Enum.Name will be the name of the Font.

local namefont = Instance.new("StringValue", nameItems)
namefont.Name = "Font"
namefont.Value = font.Name