The pixel size would be directly affected by the resolution of decal you upload to Roblox. I think the maximum pixel size my plugin uses is 480px by 480px which would mean that each character is 20x30px. So as long as your character size does not go over 30 pixels you should not see a difference in resolution. It does allow you to go over 100 text size but the resolution may be a bit worse
Short answer: It will allow you to go over 100 FontSize but resolution for characters will still become pixilated
Sorry for the bump but I just released version 1.2 of the plugin that introduces attributes to each of the textboxes. This means that every time a new text label is created it will need to use the :GetAttribute() or :SetAttribute() method to edit things like “Text”, “TextSize”, and other properties.
---- ALL CODE THAT IS NOT UPDATED TO ACCOUNT FOR THIS CHANGE WILL BE BROKEN!!! ----
Sorry for the inconvenience but Attributes are a much easier/quicker way of editing values than the instance values that were used before this version
Also /n was released and the right horizontal option is not completely stable as an FYI. Thanks for using the plugin!
I’ve found a bug just now. I’m using this in order to make a realistic font for vehicle registration plates. But it seems that one number in particular the script is not happy with. The number is 972. If you try and set the text to anything containing 972 the script returns this error.
CustomText (Server).Config.CustomTextMaker:143: attempt to index nil with ‘AnchorPoint’ - Server - CustomTextMaker:143
This occurs 100% of the time in all the functions that are trying to set the text.
Fixed! There was a logic error in my if statements, it should work now. I’ll publish the fix soon, just update the plugin and re-insert the custom text object!
Thank you for the bug report and I’m glad people are still using this plugin :)!
Cool. Thanks a ton. And also. Have you got any plans of (or if you are already working on it) adding a TextScaled ability? Since I’m now wanting to apply this to a Bus Destination sign to give it a dot matrix font. Basically so the text size changes depending on the length of the text. If this isn’t possible/not going to come any time soon then are they any workarounds I could use?
I have not planned on making a TextScaled ability but you should be able to create one by adjusting the text size.
The size is just the pixels in height that the characters take up so what you would need to do is loop through the TextCharacters Folder underneath the UI and see how many letters there are (including spaces) and then calculate the number of pixels it takes up on the x-axis. Then if the size is too large for its container (the parent object) it scales the numbers down to the correct scale. This would only work for *center alignment without wrapped text.
Here is a function that may work, but it has the basic idea there (It would be put in a script that you change the text of the Custom UI in)
local UI = script.Parent --Replace with Custom Text UI
--Should be called every time AFTER you set a NEW text value
-- NOTE: ONLY WORKS ON CENTERED TEXT WITHOUT WRAPPING
local function ScaleText()
local TextSize = UI:GetAttribute("TextSize")
local CharacterSpacing = UI:GetAttribute("CharacterSpacing")
local LowestX = 0
local HighestX = 0
for i,v in pairs(UI.TextCharacters:GetChildren()) do --Finding Dimentions of X and Y Values
if LowestX == 0 and HighestX == 0 then
LowestX = v.Position.X.Offset-(v.Size.X.Offset/2)
HighestX = v.Position.X.Offset+(v.Size.X.Offset/2)
end
if v.Position.X.Offset+(v.Size.X.Offset/2) > HighestX then
HighestX = v.Position.X.Offset+(v.Size.X.Offset/2)
end
if v.Position.X.Offset-(v.Size.X.Offset/2) < LowestX then
LowestX = v.Position.X.Offset-(v.Size.X.Offset/2)
end
end
--Dimentions
local lengthY = TextSize
local lengthX = HighestX-LowestX
--Checks if both dimensions are out of bounds
if UI.AbsoluteSize.X < lengthX and UI.AbsoluteSize.Y < lengthY then
--Checks which one needs scaled
if lengthX-UI.AbsoluteSize.X < lengthY-UI.AbsoluteSize.Y then --X needs scaled
UI:SetAttribute("TextSize", ((UI.AbsoluteSize.X/#UI:GetChildren()) - CharacterSpacing)/0.8) --Calcuation for X Scale
else --Y needs Scaled
UI:SetAttribute("TextSize", UI.AbsoluteSize.Y)
end
elseif lengthX > UI.AbsoluteSize.X then
--Calculating X Pixels is hard so in order to figure out the Length of the line, the equation is:
-- #UI:GetChildren()*(CharacterSpacing + TextSize*0.8) = LengthOfLine
-- A little more algebra later can then give the equation:
-- ((LengthOfLine/#UI:GetChildren()) - CharacterSpacing)/0.8 = TextSize
UI:SetAttribute("TextSize", ((UI.AbsoluteSize.X/#UI:GetChildren()) - CharacterSpacing)/0.8) --Calcuation for X Scale
elseif lengthY >UI.AbsoluteSize.Y then
UI:SetAttribute("TextSize", UI.AbsoluteSize.Y)
end
end
This function should only be called after you change the text and just calculates and sets the pixels in the frame! Hope this helps!
Given the function a go but not working. The script gives this error: (SetText is the name of the script.)
SetText:42: attempt to perform arithmetic (sub) on number and nil - Server - SetText:42
This seems like a really cool plugin! I have made a font sheet, and uploaded it to Roblox. When I follow the instructions to create a new Frame, everything runs smoothly until I try to edit the text. For some reason, although the frame is there, no text will appear no matter what. How can I fix this?
EDIT: Actually, it appears in the game when I test it. For some reason though, it doesn’t appear in studio. I don’t know why this bug occurs though, sorry.
Another thing I noticed is that when you try to change the TextSize, it doesn’t fit in the frame. Same thing when you try to scale the frame itself. This is kind of weird because now the text is above the frame, and slightly to the right. Because of this and the fact that I can’t see the text, I have to blindly position the frame below where I want it to be, and keep testing the game over and over until it looks good.
Yes, right now text can only be shown when playing/testing in the game because it runs off of a local script or script (Depending on serverside or locally) that only runs when the game is played. The only way you could make a studio editor for the text is by making a plugin that would automatically update the custom text GUI while in studio. Right now I cannot make that sort of update to the plugin but feel free to try it for yourself if you would like!
I thought I had everything figured out, but I come back a few months later to finish implementing the custom text feature into my game, and for some reason, on different devices, the text is in completely random places. Is there a certain way I have to keep the Frame in the right spot or something (maybe via script)? The Frame is using Scale instead of Offset, (just like all of my other GUIs), but it just isn’t staying in the right place (unlike my other GUIs). Sorry for the bump, but this is just driving me crazy!
Update: So, I don’t know what caused the issue to happen with the original Frame, but I deleted it and remade it. This time, it works (AutoScale Plus REALLY helps, btw)! However, I noticed that when testing on different sized devices, the font size always stays the same, which can actually force the text to move around the screen to find space. I’m not sure if there’s any way for the TextSize attribute to automatically scale depending on the devices size, but if there were to be an update for the plugin, I think this should be one of the priorities. One easy work-around I thought of was to make a table in a script, and the current screen size will change what the TextSize attribute is. The user could also change the tables values to find what works best for them. However, I don’t really know much about tables lol .
Anyways, this is a very innovative plugin, definitely one of my favorites, and I hope it catches on!
Hmm, I’ll look into the issue. The code I wrote above for the text auto-scale isn’t implemented with the plugin yet but when I do (hopefully soon lol) I will be sure to look into making the text better looking on different devices. Thank you for the feedback!
Sorry I haven’t been supporting the plug-in for a while and kind of let it go for a bit while working on other projects. Don’t worry, I have in mind updating the plugin to be more user-friendly and getting some more tutorials for the plugin too so just be patient… Thank you!
This is still an amazing plugin. The only thing I have with it is that you need to manually create and position the characters on the sprite sheet which sometimes can be a pain to do. What would be cool would be if you could get somebody to program a tool that could take a ttf/otf file as the input and automatically generate the sprite sheet from it.