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

how to retrieve get face GUI for leaderboards?

hi there, I am trying to retrieve player faces and make a graph like this screenshot.

screenshot

currently my code can only determine how much height a player has from the base plate. here is the code.

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)

any idea how to make a height graph that can convert the height value of the above code into a graph?

1 answer

✓ Accepted answer

This Script positions the icon up and down its parent depending on the player's height relative to the max height. You can add background etc to customize it.

LocalScript inside a GUI object (Only for your player):

local MaxHeight = 20 -- Change this I don't know how much it is.
local Player = game.Players.LocalPlayer
local LeaderStats = Player:WaitForChild("leaderstats")
local Height = LeaderStats:WaitForChild("Height")

local Icon = Instance.new("ImageLabel")
Icon.BackGroundTransparency = 1
Icon.Size = UDim2.new(0.05,0,0.05,0)

local RatioConstraint = Instance.new("UiAspectRatioConstraint",Icon)

local UserId = Player.UserId
local ThumbnailType = Enum.ThumbnailType.HeadShot
local ThumbnailSize = Enum.ThumbnailSize.Size420x420
local Thumbnail, isReady = game.Players:GetUserThumbnailAsync(UserId, ThumbnailType, ThumbnailSize)
Icon.Image = Thumbnail
Icon.Parent = script.Parent

local function PlaceIcon()
	Icon:TweenPosition(UDim2.new(0.95,0,(Height.Value/MaxHeight),0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.2,true)
end

game:GetService("RunService"):BindToRenderStep("BindPosition", 1, PlaceIcon)

This should work.

2 comments

0

I did put that code but it made the icon thumbnail go down when a player goes up. how to make the icon go up also when a players height increases?

0

Oh sorry, you can do 1 - (Height.Value/Maxheight) instead in the tweening line. :)

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