Empty
Empty
Empty
스타터GUI는 Roblox에서 GUI(그래픽 사용자 인터페이스) 요소를 관리하는 서비스입니다. 게임에 참가하는 각 플레이어의 PlayerGui에 이 요소들이 복제됩니다.
Empty
Empty
Empty
스타터GUI에 배치된 스크립트는 보통 플레이어가 게임 도중 상호작용하는 버튼, 메뉴, 기타 인터페이스 요소를 제어합니다.
스타터GUI 예제
Empty
Empty
Empty
-- 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()
Roblox Studio