StarterGui

StarterGui es un servicio en Roblox que almacena elementos GUI (Interfaz Gráfica de Usuario) que se clonan en el PlayerGui de cada jugador cuando se unen al juego.

Los scripts colocados en StarterGui típicamente controlan los elementos de la interfaz de usuario, como botones, menús y otros elementos con los que los jugadores interactúan durante el juego.

Ejemplo de StarterGui

-- StarterGui > HealthGui > HealthScript

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local healthGui = script.Parent
local healthBar = healthGui:WaitForChild("Frame")
local healthLabel = healthBar:WaitForChild("TextLabel")

local function updateHealth()
    local humanoid = character:FindFirstChildOfClass("Humanoid")
    if humanoid then
        local healthPercent = humanoid.Health / humanoid.MaxHealth
        healthBar.Size = UDim2.new(healthPercent, 0, 1, 0)
        healthLabel.Text = math.ceil(humanoid.Health) .. " / " .. math.ceil(humanoid.MaxHealth)
    end
end

local humanoid = character:WaitForChild("Humanoid")
humanoid.HealthChanged:Connect(updateHealth)

updateHealth()
Image 1
Image 2
Roblox Studio