Top.Mail.Ru
Ответы

Скрипт roblox studio

написал скрипт, вроде он сам работает, текст gui заменяется, а в игре он остается таким же, то есть как был label (по дефолту) так и остался, как сделать что бы он обновлялся?

-- переменные

local player = game.Players.LocalPlayer
local humanoid = game.Players.LocalPlayer.WaitForChild("Humanoid")
local txtl = game.StarterGui.hpGui.Frame.TextLabel

-- скрипт

while wait(1) do

txtl.Text = humanoid.Health

end

По дате
По рейтингу
Аватар пользователя
Оракул
10мес
123456789101112
 -- Переменные  
 
local player = game.Players.LocalPlayer  
local character = player.Character or player.CharacterAdded:Wait()  
local humanoid = character:WaitForChild("Humanoid")  
local txtl = player:WaitForChild("PlayerGui"):WaitForChild("hpGui").Frame.TextLabel  
 
-- Скрипт  
 
humanoid.HealthChanged:Connect(function(health) 
    txtl.Text = tostring(math.floor(health))  -- Приводим значение здоровья к строке 
end)