#Gui position

1 messages · Page 1 of 1 (latest)

stark cipher
#

details: it is an image label, the anchor point is set to (0.5,1), its basically like the tower of hell bar, it is a local script as well.

So i've been trying to get my image label to start at the bottom of my bar but everytime i load in to test it it looks like this. I am not that experienced with gui and scripting but anyways this is my script: local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local HeightGui = PlayerGui:WaitForChild("HeightGui")
local ImageLabel = HeightGui:WaitForChild("Frame"):WaitForChild("ImageLabel")

local function updatePosition()
local Character = workspace:FindFirstChild(Player.Name)
if not Character then return end

local PrimaryPart = Character:FindFirstChild("UpperTorso") or Character:FindFirstChild("Torso")
if not PrimaryPart then return end

local heightValue = math.clamp(PrimaryPart.Position.Y, 0, 50) -- Clamp for sanity
local percent = heightValue / 50 -- Convert to 0–1 scale
local yOffset = 1 - percent -- Invert so 0 height = bottom

ImageLabel.Position = UDim2.new(
    ImageLabel.Position.X.Scale,
    ImageLabel.Position.X.Offset,
    yOffset,
    ImageLabel.Position.Y.Offset
)

end

RunService.RenderStepped:Connect(updatePosition)

languid wind
#

for the y offset value in the udim2 you need to subtract half the size of the bar i think

#

i think youd need to use absolutesize to get it in pixels but idk

#

@stark cipher

half lilyBOT
#

studio** You are now Level 1! **studio