How can i save a font in my datastore

yeah how do i change it

local essencesave =  {
		EssenceName = essence.SurfaceGui.Essence.Text,
		EssenceColor = essencecolor,
		EssenceFont = Font.fromEnum(essence.SurfaceGui.Essence.FontFace), --this line gives me errors :(
		Chance = essence.chance.SurfaceGui.Chance.Text,
	}

local datatobesaved = {
		Rolls = plr.leaderstats.Rolls.Value,
		ItemTable = items,
		CurrentEssence = essencesave,
		
	}

this is the given error:
image

4 Likes

to save enum values in datastores, you have to save the enum as its name.

then when loading, load it as

enum.front[fontname]

4 Likes

how do i save its name only in my datastore

4 Likes

Wait I just realized problem with your script,

change

EssenceFont = Font.fromEnum(essence.SurfaceGui.Essence.FontFace), --this line gives me errors :(

to

EssenceFont = Enum.Font[essence.SurfaceGui.Essence.Font.Name], --this line gives me errors :(

you can’t save Enum, but you can save its name, then load it later by doing

Enum.Font[EssenceFont]

2 Likes
function module.Configure(data, essence)
	local EssenceName = data['EssenceName']
	local EssenceColor = data['EssenceColor']
	local EssenceFont = data['EssenceFont']
	
	
	local Chance = data['Chance']
	
	essence.SurfaceGui.Essence.Text = EssenceName
	essence.SurfaceGui.Essence.Font = Enum.Font[EssenceFont]
	essence.SurfaceGui.Essence.TextColor3 = Color3.fromHex(EssenceColor)
	local essenceuistroke = Instance.new('UIStroke')
	local clone = essenceuistroke:Clone()
clone.Parent = essence.SurfaceGui.Essence	

essence.chance.SurfaceGui.Chance.Text = Chance
local clone2 = essenceuistroke:Clone()
clone2.Color = Color3.fromRGB(255,255,255)
clone.Parent = essence.chance.SurfaceGui.Chance
end

return module


there is an error
Roblox thinks “EssenceFont” is nil?

1 Like

how did you store the essence font

1 Like
local essencesave =  {
		EssenceName = essence.SurfaceGui.Essence.Text,
		EssenceColor = essencecolor,
		EssenceFont = Enum.Font[essence.SurfaceGui.Essence.Font.Name], 
		Chance = essence.chance.SurfaceGui.Chance.Text,
	}

like u told me to

1 Like

oh I did it wrong do this instead

EssenceFont = essence.SurfaceGui.Essence.Font.Name, 
1 Like

thank you! this works perfectly :smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.