Получение ошибки в скрипте валюты в студии ROBLOX - PullRequest
0 голосов
/ 06 февраля 2020

Я получаю сообщение об ошибке в своем скрипте валюты в Roblox studio

local currencyName = "Coins"
local DataStore = game:GetService(("DataStoreService"):GetDataStore("TestDataStore")
game.Players.PlayerAdded:Connect(function(player)

    local folder = Instance.new("Folder")
    folder.Name = "leaderstats"
    folder.Parent = player

    local currency = Instance.new("IntValue")
    currency.Name = currencyName
    currency.Parent = folder

    local ID =""currencyName.."-"..player.UserId
    local savedData = nil

    pcall(function())
        savedData = DataStore:GetAsync(ID)
    end)

    if savedData ~= nil then
        curreny.Value = savedData
        print("Data loaded")
    else
        currency.Value = 10 -- amount to a new player
        print("New player to the game")
    end
end)

game.Plyers.PlayerRemoving:Connect(function(player)
    local ID =""currencyName.."-"..player.UserId
    DataStore:SetAsync(ID,player.leaderstats[currencyName].Value)   

end)

game:BindToClose(function()

    -- when game is ready to shut down
    for i, player in pairs(game.Players:GetPlayers()) do
        if player then
            player:KICK("This game is shutting down")
        end
    end

    wait(5)
end)

Это выдает мне эту ошибку в строке 3:

10: 30: 47.749 - CurrencyScript.Script: 3: ожидается ')' (закрыть) ('в строке 2), получено' game '

10: 30: 49.909 - невозможно использовать InsertService для загрузки ресурсов с клиента

1 Ответ

1 голос
/ 06 февраля 2020

Ожидается ')' (для закрытия '(' в строке 2),

В строке 2 слишком много скобок.

local DataStore = game:GetService("DataStoreService"):GetDataStore("TestDataStore")
...