I want to make a coordiante script, I know how to get the coordiantes but i dont know where to put this script, nor how to print the values on an UI
PS: Sorry if there are any grammar mistakes in this script, i wrote it in here without autocorrect,
Local player = workspace.Players.LocalPlayer
Local x = player.Character.HumanoidRootPart.Position.x
Local y = player.Character.HumanoidRootPart.Position.y
Local z = player.Character.HumanoidRootPart.Position.z
Players is not in workspace, Itâs in the DataModel (game, so game.Players.LocalPlayer). To print these values out, you would just do: print("X value: "..tostring(x).."\nY value: "..tostring(y).."\nZ value: "..tostring(z))
Keep in mind to constantly get the coordinates, you would need to put the above code inside of a loop.
Local player = game.Players.LocalPlayer
Local coordinates = {
Local x =
player.Character.HumanoidRootPart.Position.x
Local y = player.Character.HumanoidRootPart.Position.y
Local z = player.Character.HumanoidRootPart.Position.z
}
For i, v in pairs(coordinates) do
Blablabla
end)
No, donât put it in a table. Also, your loop is wrong, for should not be capitalized and you need to specify something inside of pairs() â Check out this link to learn more about loops. I was also thinking more of a while condition do loop, but for wouldnât work without a table anyways.
No, it will not update, with that being said you should put this localscript inside of StarterCharacterScripts since it may error if the playerâs character hasnât loaded in to the game before the player (which is impossible).
pairs() requires a table, and itâs just easier to put all the values in X, Y, and Z variables, but if you really want to use a table, donât use local inside those tables. Instance:
local coords = {
x = 1,
y = 2,
y = 3 -- change these values to fit your code
}
Just change a TextLabelâs .Text property to a new string or add on to it by using TextLabel.Text = TextLabel.Text + " hello, world!"
so if the textlabelâs .Text property was âHmâ, the new textlabelâs .Text property would be âHm hello, world!â