Physical player statistics to gui display issue

I’ve been trying to get the Y-level position of a player every time said position updates (checking workspace player position from the humanoidrootpart) but I guess I’m not getting it right.

I even tried just referencing the actual position property instead of Y; but instead of the script getting the position property, it’s apparently seeing it as Vector3 instead and erroring out whenever I try to detect a change here. Any help with this?

GetPropertyChangedSignal won’t work unless you connect it directly to the instance you want to listen to. In your script, you’re using char:GetPropertChangedSignal, and the player character is a model. However, Instance.Changed and Instance:GetPropertyChangedSignal will only work when the object is updated through code, so instead, you’ll want to have a loop constantly checking for their position.

local player = game.Players.LocalPlayer

local char = player.Character

local rootPart = char:WaitForChild("HumanoidRootPart")

game:GetService("RunService").RenderStepped:Connect(function()

if rootPart then

local pos = rootPart.Position

script.Parent.YLevel.MainDisplay.Text = "Y Level: "..pos.Y

end

end)```

I either probably wasn’t as as clear as I could have been or I’m not exactly understanding you’re explanation partially. What I’m trying to do is get the y position of the humanoidrootpart AT ALL times regardless of where the player is currently located, make sure that position is being displayed, and not just check/display for when it reaches a specific y level that was stored by the code’s first check on the player’s position.

Oh, so you want the Position to be accessed at all times? This should work.

local player = game.Players.LocalPlayer
local char = player.Character
local rootPart = char:WaitForChild("HumanoidRootPart")
local pos --Store the position here

game:GetService("RunService").RenderStepped:Connect(function()

if rootPart then

pos = rootPart.Position --Set "Pos"

script.Parent.YLevel.MainDisplay.Text = "Y Level: "..pos.Y

end

end)

This will constantly update the “pos” variable no matter what, as long as the HumanoidRootPart exists. This can also be accessed by other parts of the code if needbe. I hope this helps!

1 Like