Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Humanoidrootpart not valid member of localplayer? Alternative?

So I'm trying to make a game about jumping, and i need the players Y pos so I can put it on a gui, but when i try to pull it from the local player it says " "HumanoidRootPart" is not valid member of MrBucketOfficial" so this means that this doesn't work, but how would I use an alternative? If it helps, I'm using a local script for this and I will put the code below.

local player = game.Players.LocalPlayer
local playerY = player.HumanoidRootPart.Position.Y

playerY.Changed:Connect(function()
	script.Parent.Text = "Height: " .. playerY .. "Studs"
end)

1 answer

✓ Accepted answer

you have to wait for the player to load like this

local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:wait()
--do stuff here

This discussion is preserved as it was. New answers, comments, and votes are closed.