A height determining GUI?

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

  1. What do you want to achieve?
    I would like to replicate this GUI.

  2. What is the issue?
    I have no idea on how to go about this. I would like to create just a simple GUI that determines how high players are just like that picture above.

  3. What solutions have you tried so far?
    I have tried asking around discord, friends, free models, and I have even tried to create my own but I have 0 idea on how to determine how high a player might be and then putting that onto a GUI.

My goal is to use the gui for something other than height. I want to use it for determining what player has the most of this or that and then determining their position on the gui. Can I possibly get some help with a simple piece of code to start me off or something helpful?

2 Likes

Sorry for my bad explanation, but I’ll try my best

You could get the HumanoidRootPart Y CFrame, and make the Player Template Y move as the HumanoidRootPart move?

also, there are some videos on YouTube. You should take a look

Again, sorry for my terrible explanation

You should make remote event or remote function to check for the height. You should use CFrame.Y to find the height then :Fire(height) on the client side move the players Gui to their height and check it very often.

1 Like

Or if you’re trying to make a game like ToH, I’d like to recommend watching these videos (they are continuations of each other)

(here he added the Height Bar yay lol)

This script is better,

local frame = Instance.new("Frame") -- Instancing the heightbar
frame.Parent = script.Parent
frame.Size = UDim2.new(.015,0,.639,0)
frame.Position = UDim2.new(.97,0,.2)
frame.BorderSizePixel = 0
game:GetService("RunService").RenderStepped:Connect(function()-- Add a Renderstepped so it keeps on detecting a new player or a player moving. Renderstepped might be smoother
	for _,plr in pairs(game.Players:GetChildren()) do
		if not frame:FindFirstChild(plr.Name) then -- Check if the player isn't inside the frame or else it would cause major lag issues.
			plrHeight = Instance.new("ImageLabel") -- Instancing a player icon so it appears on the height bar.
			plrHeight.Parent = frame
			plrHeight.Size = UDim2.new(2,0,.06,0)
			plrHeight.ScaleType = Enum.ScaleType.Fit
			plrHeight.BackgroundTransparency = 1
			plrHeight.BorderSizePixel = 0
			plrHeight.Name = plr.Name
			plrHeight.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..plr.UserId.."&width=48&height=48&format=png"
		end	
		repeat wait() until plr.Character -- Keeps on waiting until it finds the player's character.
			local plrcenter = plr.Character:FindFirstChild("HumanoidRootPart")
			if plrcenter then
			plrHeight.Position = UDim2.new(-1.65,0,.975-plrcenter.Position.Y/150) -- Change the 150 to whatever you want NOTE: That number is the height you want it to count.		
		end
	end
end)


Its a small script and no need to do anything! just copy and paste it into a screengui in a local script.

1 Like

I wrote a small script that should be decently optimized. If you put this in a LocalScript it’ll do all of the work for you.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local events = {}
local height = 50 -- the position (on the Y-axis) that will be considered the top
local plr = Players.LocalPlayer

-- create the ui
local gui = Instance.new("ScreenGui")
gui.ResetOnSpawn = false
gui.Name = "HeightTracker"
gui.Parent = plr:WaitForChild("PlayerGui")

local bar = Instance.new("Frame")
bar.AnchorPoint = Vector2.new(1, 0.5)
bar.BorderSizePixel = 0
bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
bar.Position = UDim2.new(1, -15, 0.5, 0)
bar.Size = UDim2.fromScale(0.025, 0.7)
bar.Name = "Bar"
bar.Parent = gui

local templateImage = Instance.new("ImageLabel")
templateImage.BackgroundTransparency = 1
templateImage.BorderSizePixel = 0
templateImage.Size = UDim2.fromOffset(48, 48)
templateImage.AnchorPoint = Vector2.new(1, 0.5)

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(1, 0)
corner.Parent = templateImage

local function track(player)
    local image = templateImage:Clone()
    image.Image = Players:GetUserThumbnailAsync(player.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size48x48)
    image.Name = player.Name
    image.Parent = bar

    events[player.Name] = {
	    -- monitor the player's position
	    RunService.RenderStepped:Connect(function()
		    -- wrapped in pcall to prevent error when they die. there are better ways of doing this
		    pcall(function()
			    local chr = player.Character or player.CharacterAdded:wait()
			    local pos = chr.HumanoidRootPart.Position.Y

			    image.Position = UDim2.fromScale(0, (1 - (pos / height)))
		    end)
	    end)
    }
end

-- remove player images on leave & disconnect events
local function clean(player)
    local image = bar:FindFirstChild(player.Name)
    if image then
	    image:Destroy()
	    if events[player.Name] then
		    events[player.Name]:Disconnect()
	    end
    end
end

-- track the players
for _,player in pairs(Players:GetPlayers()) do
    track(player)
end

Players.PlayerAdded:Connect(track)
Players.PlayerRemoving:Connect(clean)
1 Like

Thank you all for the replies. They all work. Thanks!

2 Likes