Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

')' expected (to close '(' at line 65) near '<eof>'?

Asked by 5 years ago

Is there a problem with my script, also leader board doesn't show up and save data. I'll just give the whole script

local dataStores = game:GetService("DataStoreService"):GetDataStore("CashDataStore") local defaultCash = 0 local playersLeft = 0 game.Players.PlayerAdded:Connect(function(player)

playersleft = playersLeft + 1

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

local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0 
cash.Parent = leaderstats

player.CharacterAdded:Connect(function(character)
    character.Humanoid.WalkSpeed = 16
    character.Humanoid.Died:Connect(function()
        --Whenever someone dies, this event will run

        if character.Humanoid and character.Humanoid:FindFirstChild("creator") then
            game.ReplicatedStorage.Status.Value = tostring(character.Humanoid.creator.Value).."KILLED"..player.name
        end

        if character:FindFirstChild("GameTag") then
            character.Gametag:Destroy()
        end

       player.LoadCharacter()
    end)

end)

-- Data Stores

local player_data

pcall(function()
    player_data = dataStores:GetAsync(player:UserId"-Cash") --872526582-Cash
end)

if player_data ~= nil then
    -- Player has saved data , load it in
else
    -- New player
    cash.Value = defaultCash
end

end)

local bindableEvent = Instance.new("BindableEvent")

game.Players.PlayerRemoving:Connect(function(player)

pcall(function()
    dataStores:SetAsync(player.UserId.."-Cash",player.leaderstats.Cash.Value)
    print("Saved")
    playersLeft = playersLeft - 1
    bindableEvent:Fire()
end)

end)

game:BindToClose(function() -- This wil be triggered upon shutdown while playersLeft > 0 do end end

0
Leadderboard doesn't show up Bloomeep 24 — 5y

1 answer

Log in to vote
0
Answered by
AltNature 169
5 years ago
Edited 5 years ago

At the end of your entire script you should have a end) as to your BindToClose function at the end. In your script I read now I see end end when the last end should have a parenthesis because that is how to properly end functions.

Basically all you need to do is replace that last end with a ")" so it becomes end)

and when your output tells you it is expecting a parenthesis on a end you should put it there. You can tell it is telling you to when it says ")" expected near (whatever line) at the <eof> "End Of function"

Ad

Answer this question