hi there, I had been able in creating a player Y position indicator that can display how high is the humanoid from the ground. which is beneficial in determining the success factor in the game I am creating. kind of like tower of hell.
here is the code that I created that shows the player's height from the ground in the leaderstat. and here is the screenshot of the said leaderstat
local function OnPlayerJoin(player) repeat wait() until player.Character local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Height = Instance.new("IntValue") Height.Name = "Height" Height.Parent = leaderstats while wait() do Height.Value = (player.Character.HumanoidRootPart.Position.Y - 8) end end game.Players.PlayerAdded:Connect(OnPlayerJoin)
but right now I am trying to turn this number info into a graph like tower of hell did. any suggestion of how I can turn it in like a graph in Tower of Hell game did?
here is the TOH screenshot. graph
Quite easy. First, I would get the max height of the graph (the end of the tower):
local maxheight = 200
Then, I would get the percentage completion of tower (percent formula is numerator divided by denominator)
local Players = game.Players local LocalPlayer = Players. LocalPlayer local percentage = LocalPlayer.leaderstats:FindFirstChild(“Height”) / 200
Then, I would move the player’s head in the gui up depending on the percentage completed. Use a for loop to update each gui. Replace blablabla with the constant Xpos scale.
gui.Position = UDIM2.new(blablabla,0,1 - percentage, 0)
That is the logic for a Ypos graph. Sorry for any syntax or formatting errors; I am typing this on mobile at school.