Player Health/Stamina GUI Example

PHOTO EMBED

Mon May 22 2023 15:30:07 GMT+0000 (Coordinated Universal Time)

Saved by @JasonM

-- Function to enable a GUI that shows the players inventory and health/stamina

function enablePlayerGUI(x, y)
    -- Check if x and y are numbers
    if type(x) ~= "number" or type(y) ~= "number" then
        print("Error: x and y must be numbers") -- Must put in coordinates and you can customize the print command
        return
    end
    
    -- Calculate the position of the GUI based on x and y
    local guiX = math.floor(x * 10)
    local guiY = math.floor(y * 10)
    
    -- Show the GUI at the calculated position
    showGUI(guiX, guiY)
end

-- Function to show the GUI at the specified position
function showGUI(x, y)
    -- Code to show the GUI at the specified position
    print("Showing GUI at (" .. x .. ", " .. y .. ")")
end
content_copyCOPY

An example on how to code and position a health/stamina bar in Roblox Studio.

https://codepal.ai/item/646b86129ad356add3b835e3