fix(lua-games): кириллические имена leaderstats через bracket access

Lua не поддерживает кириллицу в именах identifier'ов (только в строках).
stats.Монеты вызывал parser error:
  <name> expected near '<\208>'  (0xD0 = первый байт UTF-8 кириллицы)

Заменено на безопасный синтаксис:
  stats.Монеты         → stats['Монеты']
  stats.Ключ           → stats['Ключ']
  stats.Клики          → stats['Клики']

Затронуты игры: collect-coins (1), trader (13), key-chest (17),
shop (29), clicker (46). Все 9 случаев исправлены.

Теперь монетки в игре 1 должны нормально увеличивать счётчик.
This commit is contained in:
min 2026-06-09 06:42:18 +03:00
parent 3757eace9f
commit ee0ab60381

View File

@ -84,7 +84,7 @@ coinEvent.Event:Connect(function()
for _, p in ipairs(Players:GetPlayers()) do
local stats = p:FindFirstChild("leaderstats")
if stats and stats:FindFirstChild("Монеты") then
stats.Монеты.Value = score
stats['Монеты'].Value = score
end
end
print("Собрано: " .. score)
@ -445,11 +445,11 @@ part.Touched:Connect(function(hit)
if not player then return end
local stats = player:FindFirstChild("leaderstats")
if not stats then return end
if stats.Монеты.Value >= 5 then
stats.Монеты.Value = stats.Монеты.Value - 5
if stats['Монеты'].Value >= 5 then
stats['Монеты'].Value = stats['Монеты'].Value - 5
local h = hit.Parent:FindFirstChild("Humanoid")
if h then h.Health = math.min(h.MaxHealth, h.Health + 50) end
print("Купил зелье! +50 HP. Осталось монет: " .. stats.Монеты.Value)
print("Купил зелье! +50 HP. Осталось монет: " .. stats['Монеты'].Value)
else
print("Не хватает монет! Нужно 5")
end
@ -566,7 +566,7 @@ part.Touched:Connect(function(hit)
if not player then return end
local stats = player:FindFirstChild("leaderstats")
if stats and stats:FindFirstChild("Ключ") then
stats.Ключ.Value = true
stats['Ключ'].Value = true
print("Подобрал ключ!")
part:Destroy()
end
@ -578,7 +578,7 @@ part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
local stats = player:FindFirstChild("leaderstats")
if stats and stats.Ключ and stats.Ключ.Value then
if stats and stats['Ключ'] and stats['Ключ'].Value then
print("Сундук открыт! ПОБЕДА!")
part.Color = Color3.fromRGB(255, 215, 0)
else
@ -900,8 +900,8 @@ part.Touched:Connect(function(hit)
if not player then return end
local stats = player:FindFirstChild("leaderstats")
if not stats then return end
if stats.Монеты.Value >= price then
stats.Монеты.Value = stats.Монеты.Value - price
if stats['Монеты'].Value >= price then
stats['Монеты'].Value = stats['Монеты'].Value - price
bought = true
print("Куплено! Цена: " .. price)
part.Transparency = 0.7
@ -1010,7 +1010,7 @@ end
local function onClick(player)
local stats = player:FindFirstChild("leaderstats")
if stats and stats:FindFirstChild("Клики") then
stats.Клики.Value = stats.Клики.Value + 1
stats['Клики'].Value = stats['Клики'].Value + 1
end
end