Positioning GUI next to a GuiObject by script

Hi, my name is Mac! You might know me as macOSX_RobloxApp!
I would like to automatically position a text-label next to another text label by getting the length.

I’ve tried looking around, there are not many solutions, and they don’t help that much.

This will use multiple text labels to do something like this:
EX: These are text Labels
From Tester [different text label] { admin }

1 Like

What you’re looking for is TextBounds which is a property of TextLabel.

local LengthAcross = TextLabel.TextBounds.X

print(LengthAcross) --Returns length(in pixels) of the text inside the textLabel

edit: I realized you’re looking to just position the two next to each other.

You can do this by getting the Position of one

  • If using Scale:
local p = TextLabel.Position.X.Scale
local s = TextLabel.Size.X.Scale
local x = p + s

NewTextLabel.Position = UDim2.new(UpdatedP, 0, [y scale goes here], 0)
  • if using Offset
local p = TextLabel.Position.X.Offset
local s = TextLabel.Size.X.Offset
local x = p + s

NewTextLabel.Position = UDim2.new(0, x, 0, [y offset goes here])

I know this is off topic tho, but what do you do if a remote event fires based off the players in-game?

I don’t understand the question…

If you’re referring to exploiters hacking to fire remote events, you’ll need to put in preventive measures (on the server) to make sure that the remote event fire was possible.

If this isn’t what you mean please re-phrase your question.

Nope, when one player is in the game it fires once. When two players are in the game it fires twice. (goes on and on)

Maybe onPlayerAdded, fire a remote All clients

It’s in a local script that = nil, so I’m not sure why it does this.

If you want to fire a remote to all clients, do it on server.
If you really want to use a local script, then you should fire a remote when the script starts to server, and from server fire to all clients

I understand that. One problem is when another player comes, the script fires the event for them too, meaning it adds twice if it’s two players. Sorry for the confusion.

Make a table on playerAdded on server.
Using that table, decide to which player fire the remote.

Btw. You mean, if theres 2 players, fire the remote 2 times for each player in server?
Can I know the reason?

Sorry, its a little confusing what u are saying.
What is on the client? the script in ur first post? or the system that u wanna use to fire remotes to all other clients?

A little of context on ur question would help a lot. What kind of system are u designing, the purpose? So I can suggest an approach and some code maybe