Scripting 在ROBLOX studio中获取货币脚本中的错误

Scripting 在ROBLOX studio中获取货币脚本中的错误,scripting,roblox,Scripting,Roblox,我在Roblox studio中的货币脚本中出错 local currencyName = "Coins" local DataStore = game:GetService(("DataStoreService"):GetDataStore("TestDataStore") game.Players.PlayerAdded:Connect(function(player) local folder = Instanc

我在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:Expected')(要关闭“(”在第2行),得到“game”

10:30:49.909-无法使用InsertService从客户端加载资产

预期“)”(第2行的“(”关闭)

第2行中的括号太多

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