TextBounds returning '0, 0'

Hello,

I am currently creating a radio system for this project, and I am creating a TextLabel inside a Frame, but when I print its TextBounds, it returns Also, this is on the server

But, when I look in the explorer, it doesn’t return ‘0, 0’:

Any help would be greatly appreciated.

Server
if radio_on and currentCategory then
	local temp_name = ui_teams.name:Clone()
	local new_category = ui_teams:FindFirstChild(currentCategory)
	
	temp_name.Parent = new_category
	temp_name.Name = plr.Name
	temp_name.Text = string.format("[%s]: %s", plr.Name, tostring(args[3]))
	temp_name.Visible = true
	temp_name.Size = UDim2.new(1, 0, 0, temp_name.TextBounds.Y)
	
	print(temp_name.TextBounds)
end
Client
player.Chatted:connect(function(msg)

event:FireServer("replicate_action", "chat", msg)

end)

Thanks in advance

Turn off textwrapped, then get the textbound properties, then you can turn it back on if need be

Thanks for the reply, but I have tried your reply and it still seems to return ‘0, 0’, I am not entirely sure if it’s on the server, or I am doing something wrong. Thanks again for your reply.

Also, sorry if I wasn’t clear enough, let me try to elaborate more:

I am making the TextLabel size.Y to fit the TextBounds.Y property, but like I said before, it’s returning ‘0, 0’.

ok try this:

TextLabel.Size = UDim2.new(0,200,0,200)
TextLabel.TextWrapped = false
TextLabel.Size = UDim2.new(0, TextBounds.X, 0, TextBounds.Y)

Also make sure to change the Text before you set the size.

TextBounds does not work on the server because text is not rendered on the server. What do you need the TextBounds on the server for?

1 Like

I should put it to the client then huh? Not sure how i’ll replicate the other messages but I’ll try to figure it out

Consider using TextService | Documentation - Roblox Creator Hub if you want to calculate the text bounds without the use of the TextBounds property.

As for your chat system, try to create your UI elements client-side, and keep UI and server more separate - that is, server-code stays in ServerScriptService while your UI is in the player’s PlayerGui.

3 Likes

Thanks for your reply, I will try that now.