You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
set a menu to a font that loads as soon as the player joins the game.
What is the issue? Include screenshots / videos if possible!
I am getting the error: FredokaOne is not a valid member of Enum.Font even though it works fine when you change it manually.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried adding a line to see when it was loaded, but it just infinitely waited.
the line that I tried adding:
repeat wait() until table.find(Enum.Font:GetEnumItems(),script.Parent.Value)
the full script:
local function updateFont()
for _, object in pairs(script.Parent.Parent.Parent.Parent.Parent.Parent:GetDescendants()) do
if object:IsA("TextButton") or object:IsA("TextLabel") or object:IsA("TextBox") then
object.Font = Enum.Font[script.Parent.Value]
end
end
end
script.Parent.Changed:Connect(function()
updateFont()
end)
7z99
(cody)
May 30, 2021, 11:21pm
#2
Enums allow string values, have you tried setting the font to FredokaOne as a string?
R_obotz
(Robotz)
May 30, 2021, 11:24pm
#3
Have you tried this instead? :
object.Font = "FredokaOne"
So like this?
object.Font = Enum.Font[tostring(script.Parent.Value)]
I tried doing object.Font = script.Parent.Value
, but it erred with Invalid value ""FredokaOne"" for enum Font
R_obotz
(Robotz)
May 30, 2021, 11:39pm
#6
That’s strange. Another try would be:
object.Font = 26
And if that doesn’t work either… I honestly don’t know.
That worked, however how would I get the font number of each font? Would I have to make a table with each number and it’s font name, and find it on there?
Okay, I just made a super long if statement for setting it
if script.Parent.Value == "Arial" then
object.Font = 1
elseif script.Parent.Value == "ArialBold" then
object.Font = 2
elseif script.Parent.Value == "SourceSans" then
object.Font = 3
elseif script.Parent.Value == "SourceSansBold" then
object.Font = 4
elseif script.Parent.Value == "SourceSansSemiBold" then
object.Font = 16
elseif script.Parent.Value == "SourceSansLight" then
object.Font = 5
elseif script.Parent.Value == "SourceSansItalic" then
object.Font = 6
elseif script.Parent.Value == "Bodoni" then
object.Font = 7
elseif script.Parent.Value == "Garamond" then
object.Font = 8
elseif script.Parent.Value == "Cartoon" then
object.Font = 9
elseif script.Parent.Value == "Code" then
object.Font = 10
elseif script.Parent.Value == "Highway" then
object.Font = 11
elseif script.Parent.Value == "SciFi" then
object.Font = 12
elseif script.Parent.Value == "Arcade" then
object.Font = 13
elseif script.Parent.Value == "Fantasy" then
object.Font = 14
elseif script.Parent.Value == "Antique" then
object.Font = 15
elseif script.Parent.Value == "Gotham" then
object.Font = 17
elseif script.Parent.Value == "GothamSemiBold" then
object.Font = 18
elseif script.Parent.Value == "GothamBold" then
object.Font = 19
elseif script.Parent.Value == "GothamBlack" then
object.Font = 20
elseif script.Parent.Value == "AmaticSC" then
object.Font = 21
elseif script.Parent.Value == "Bangers" then
object.Font = 22
elseif script.Parent.Value == "Creepster" then
object.Font = 23
elseif script.Parent.Value == "DenkOne" then
object.Font = 24
elseif script.Parent.Value == "Fondamento" then
object.Font = 25
elseif script.Parent.Value == "FredokaOne" then
object.Font = 26
elseif script.Parent.Value == "GrenzeGotisch" then
object.Font = 27
elseif script.Parent.Value == "IndieFlower" then
object.Font = 28
elseif script.Parent.Value == "JosefinSans" then
object.Font = 29
elseif script.Parent.Value == "Jura" then
object.Font = 30
elseif script.Parent.Value == "Kalam" then
object.Font = 31
elseif script.Parent.Value == "LuckiestGuy" then
object.Font = 32
elseif script.Parent.Value == "Merriweather" then
object.Font = 33
elseif script.Parent.Value == "Michroma" then
object.Font = 34
elseif script.Parent.Value == "Nunito" then
object.Font = 35
elseif script.Parent.Value == "Oswald" then
object.Font = 36
elseif script.Parent.Value == "PatrickHand" then
object.Font = 37
elseif script.Parent.Value == "PermanentMarker" then
object.Font = 38
elseif script.Parent.Value == "Roboto" then
object.Font = 39
elseif script.Parent.Value == "RobotoCondensed" then
object.Font = 40
elseif script.Parent.Value == "RobotoMono" then
object.Font = 41
elseif script.Parent.Value == "Sarpanch" then
object.Font = 42
elseif script.Parent.Value == "SpecialElite" then
object.Font = 43
elseif script.Parent.Value == "TitilliumWeb" then
object.Font = 44
elseif script.Parent.Value == "Ubuntu" then
object.Font = 45
end