I am making a stat saving script but it just says ServerScriptService.Script:38: Expected ')' (to close '(' at line 34), got 'end' when i test the game... I turned on HTTP and API... Heres the script:
**game.Players.PlayerAdded:connect(function(player)
local StartingMoney = (0)
--------------------------------------------------------
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("NumberValue")
sticks.Name = "Sticks"
sticks.Parent = leaderstats
sticks.Value = StartingSticks
local dataStore = game:GetService("DataStoreService"):GetDataStore("SticksData")
starterSticks = 0--This is the starter money
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local money = Instance.new("IntValue")
sticks.Name = "Sticks" --Put ur currency name here, mine is Money
sticks.Value = dataStore:GetAsync(plr.UserId) or starterSticks
sticks.Parent = leaderstats
end)
game.Players.PlayerRemoving:Connect(function(plr)
dataStore:SetAsync(plr.UserId, plr.leaderstats.Sticks.Value)
end**

1 comment
I removed game.Players.PlayerAdded:Connect(function(plr) and tested the game but now it says ServerScriptService.Script:34: Expected 'end' (to close 'function' at line 1), got ; did you forget to close 'function' at line 21?