Роблокс студио программирование
Как сделать всплывающие подсказки?
Пример: я коснулся парта и вылез текст: привет
По дате
По рейтингу
1. Создание объекта:
- Вставь объект Part в сцену.
- Назовите его, например, "TouchPart".
- Свойство Anchored должно быть установлено в true (что б не падал).
2. Вставь Script в объект Part:
123456789101112131415161718192021222324252627282930313233343536
-- Define the part that will trigger the message
local part = script.Parent
-- Function to create a BillboardGui that will display the message
local function createBillboard(text)
local billboard = Instance.new("BillboardGui")
billboard.Size = UDim2.new(0, 200, 0, 50)
billboard.Adornee = part
billboard.AlwaysOnTop = true
local textLabel = Instance.new("TextLabel")
textLabel.Text = text
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.TextScaled = true
textLabel.BackgroundTransparency = 1
textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
textLabel.Parent = billboard
return billboard
end
-- Function that fires when the part is touched
local function onTouch(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local gui = createBillboard("Привет")
gui.Parent = player:WaitForChild("PlayerGui")
-- Optional: remove the text after a few seconds
wait(3)
gui:Destroy()
end
end
-- Connect the onTouch function to the part's Touched event
part.Touched:Connect(onTouch)
Пока
Больше по теме