Ad
Log in to vote
0

StudioService:GetClassIcon how does this even work? makes no sense

Asked by 1 month ago

Hello, I am currently making a plugin to make my scripting jobs easier but I encountered a problem because I was using free decals to use as my plugin Icon but they are not really good and look stretched. I came across this in the API documents (https://developer.roblox.com/en-us/api-reference/function/StudioService/GetClassIcon) to get the class Icon aka the Instance Icons. I am not quite sure how it works and when I tried to use it it did not work.

Thanks in advance!

{
    Image = "rbxasset://textures/ClassImages.png", -- This is where the image is stored with all the icons in it
    ImageRectOffset = Vector2.new(16, 0),
    ImageRectSize = Vector2.new(16, 16)
}

This is supposed to get the icons from the textures/ClassImages.png

local StudioService = game:GetService("StudioService")
local imageLabel = script.Parent -- What is the function of this Image.Label
local function displayClassIcon(image, className)
    for k, v in pairs(StudioService:GetClassIcon(className)) do
        image[k] = v -- Set property?
    end
end
displayClassIcon(imageLabel, "Part") -- Display but where is it displayed it isnt even mentioned

In conclusion, I am just very confused and Roblox did a very bad job at explaining this I have also tried to search on YouTube and the Developer Site but no luck.

Answer this question