fahattt
(fahattt)
#1
So basically, I’m trying to recreate robloxs spacing method for chatting and I can’t seem to figure it out.
A simple example of this would be:
I’m trying to figure out how they calculate the amount of spaces required depending on the size of a players username.
If someone could give some suggestions or examples, that’d be nice.
This is taken directly from the Roblox chat util module.
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize = self:GetStringTextBounds(str, font, textSize)
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
1 Like