Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What is causing FontLibrary to not work? [Still Unanswered]

Asked by 9 years ago

I have recently found a script that will allow me to upload custom fonts and load them into scripts that I already have. I'm currently trying to incorporate this into my rank gui script, but for some reason it isn't working. I followed the tutorial in trying to add it, but it just doesn't want to work. My lua knowledge isn't all that great either.

Edit: I was able to get rid of the errors, but now I'm left with new errors.

Message from output(Updated): 03:27:26.479 - Can't parse JSON 03:27:26.480 - Script 'ServerScriptService.FontLibrary', Line 99 - method LoadFont 03:27:26.480 - Script 'ServerScriptService.Rank Script', Line 9 03:27:26.481 - Stack End

Line 99:

local data = web:JSONDecode(info.Description)

Whole Function:

function class:LoadFont(id)
    local info = market:GetProductInfo(id)
    local data = web:JSONDecode(info.Description)
    data.image = "rbxassetid://"..id
    if not data.padding then
        data.padding = 0
    end
    if not class.Fonts[data.name] then
        class.Fonts[data.name] = {}
    end
    class.Fonts[data.name][data.size] = data
    return data
end

Line 9:

FontLibrary:LoadFont(325279010)

Font Script: http://www.roblox.com/FontLibrary-item?id=245048459

Video Explaining the usage: https://www.youtube.com/watch?v=LrwMIQwqNhA

Current Script:

local ServerStorage = game:GetService("ServerStorage")
local FontLibrary = require(script.Parent:WaitForChild("FontLibrary"))
local ExtendedTextLabel = require(script.Parent:WaitForChild("FontLibrary"):WaitForChild("ExtendedTextLabel"))
local Color = Color3.new(192/255, 192/255, 192/255)
FontLibrary:LoadFont(325279010)

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function() -- So a new character is in use.
    local rank = plr:GetRankInGroup(2696373)
    local role = plr:GetRoleInGroup(2696373)

    if rank ~= 0 then
        local Label = ExtendedTextLabel.new(ServerStorage.Rank.TextLabel)
        repeat wait() until plr.Character
        Label.Parent = plr.Character.Head
        Label.Text = role
        Label.TextColor3 = Color
        Label.Font = "ComicSansMS"
        Label.FontSize = 12
    end
end)
end)
0
Taking a glance at the code, you did not set up the 'IsInGroup' method to check to see if the Player was in the specific group, although that may not be the problem, just wanted to point that out anyway. :) TheeDeathCaster 2368 — 9y
0
That isn't the problem... The problem has something to do with the FontLibrary. Alpha_Toon 57 — 9y

Answer this question