local name = "Максим" -- строка текста
local age = 10 -- число
local isStudent = true -- логическое значение (правда/ложь)
print("Привет, " .. name .. "! Тебе " .. age .. " лет.")
local score = 85
if score > 90 then
print("Отлично! Ты получил пятерку!")
elseif score > 70 then
print("Хорошо! Ты получил четверку!")
else
print("Нужно немного постараться!")
end
for i = 1, 5 do
print("Сообщение номер: " .. i)
end
local counter = 3
while counter > 0 do
print("Осталось секунд: " .. counter)
counter = counter - 1
end
local function greet(name)
print("Привет, " .. name .. "!")
end
greet("Анна")
greet("Иван")
local fruits = {"яблоко", "банан", "апельсин"}
for i, fruit in ipairs(fruits) do
print(i .. ". " .. fruit)
end
local student = {name = "Оля", age = 11, grade = 4}
print("Имя: " .. student.name)
print("Возраст: " .. student.age)
local function calculate()
print("Введите первое число:")
local a = tonumber(io.read())
print("Введите операцию (+, -, *, /):")
local op = io.read()
print("Введите второе число:")
local b = tonumber(io.read())
if op == "+" then
print("Результат: " .. (a + b))
elseif op == "-" then
print("Результат: " .. (a - b))
elseif op == "*" then
print("Результат: " .. (a * b))
elseif op == "/" then
if b ~= 0 then
print("Результат: " .. (a / b))
else
print("Ошибка: деление на ноль!")
end
else
print("Неизвестная операция")
end
end
calculate()
math.randomseed(os.time())
local secretNumber = math.random(1, 100)
local attempts = 0
print("Я загадал число от 1 до 100. Попробуй угадать!")
while true do
print("Введи число:")
local guess = tonumber(io.read())
attempts = attempts + 1
if guess == secretNumber then
print("Поздравляю! Ты угадал за " .. attempts .. " попыток!")
break
elseif guess < secretNumber then
print("Мое число больше!")
else
print("Мое число меньше!")
end
end
local function story()
print("Ты находишься в пещере. Перед тобой два прохода: левый и правый.")
print("Куда пойдешь? (левый/правый)")
local choice = io.read()
if choice == "левый" then
print("Ты находишь сундук с сокровищами! Поздравляю, ты победил!")
elseif choice == "правый" then
print("Из темноты выскакивает дракон! Игра окончена.")
else
print("Неизвестный выбор. Попробуй еще раз.")
story()
end
end
local part = script.Parent
part.Touched:Connect(function(hit)
local character = hit.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
part.Size = part.Size * 1.5
print("Размер увеличен!")
end
end