Hello Developers,
I would wanna know, how do I add spaces by username? like the Roblox core chat?
I saw a thread like this here: How would I calculate the amount of spaces needed depended on a username?
but I have no clue or I don’t get how to do it with custom chat.
I copied:
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
What i made:
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
game.ReplicatedStorage["ChatStorage(-)"]['Normal(-)'].OnServerEvent:Connect(function(player,chat)
methods:GetNumberOfSpaces(chat, Enum.Font.SourceSansBold, 32)
end)
What I got:
ServerScriptService.Script:20: attempt to call a nil value
Thank you so much for helping me, i really appreciate it!