StarterGui

O StarterGui é um serviço no Roblox que armazena elementos GUI (Interface Gráfica do Usuário) que são clonados para o PlayerGui de cada jogador quando eles entram no jogo.

Scripts colocados no StarterGui geralmente controlam os elementos da interface, como botões, menus e outros elementos que os jogadores interagem durante o jogo.

Exemplo 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

Se você achou este tutorial útil e gostaria de apoiar meu trabalho, por favor, considere me comprar um café.

Muito obrigado pelo seu apoio!

Me compre um café