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