Wont change the text in Textlabel to what I want

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to get the position of the person who just joined the game and change the text of a textlabel to that position just for that person. Like a cordinate system.

  1. What is the issue? Include screenshots / videos if possible!

The issue is that I can print out the position of the player but it wont let me change the text of the textlabel to that position.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I tryed to find any one else who has tryed to make a cordinate system and tried to find a tutorial but couldent find one.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

The script:

local CordinatesGui = StarterGui:WaitForChild("CordinatesGui")
local MainFrame = CordinatesGui:WaitForChild("MainFrame")
local MainTxtL = MainFrame:WaitForChild("MainTxtL")

		local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
		while humanoidRootPart do
			print(player.Name,"is at",tostring(humanoidRootPart.Position))
			local Cordinates = ReplicatedStorage:WaitForChild("ChangeCordinateText")
			MainTxtL.Text = (Players.Name"is at "..humanoidRootPart.Position)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Thanks for all the help!

This looks like a server script?

While it is possible to update a player’s GUI from the server, it’s a little annoying. You’d have to fire a RemoteEvent to the client, with the data they need, and then a LocalScript on the client side has to listen to that event so it can update the PlayerGui (not the StarterGui, as you’ve done here).

However, that LocalScript already knows the position of your character, so there’s no need to ask the server for it.

In other words, put a LocalScript inside your “MainTxtL” gui (or wherever you want inside the player’s GUI hierarchy). Then access the character position directly.

Also, you forgot the tostring when setting Text:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")

local MainTxtL = script.Parent -- if you didn't put the script inside here, this would be slightly different

while true do
	local pos = root.Position
	print(player.Name, "is at", pos)
	MainTxtL.Text = player.Name .. " is at " .. tostring(pos)

Because this script is inside the GUI, it will be destroyed and re-created every time the character respawns.


Sorry for the late respond but it worked thank you so much!!!