Ok so, as you seen in the title the is a problem at this script, can you pls help me with it? ERROR: ServerScriptService.Stats:7: Expected ')' (to close '(' at line 6), got 'local'
local players = game:GetService("Players") local datastore = game:GetService("DataStoreService") local ds1 = datastore:GetDataService("ClickData") local ds2 = datastore:GetDataService("RebirthData")
players.PlayerAdded:connect(funtion(player) local folder = Instance.new("Folder") folder.name = "leaderstats" folder.Parent = player local folder2 = Instance.new("Folder") folder2.Name = "Stats" folder2.Parent = players
local currency1 = Instance.new("NumberValue") currency1.Name = 'Clicks' currency1.Parent = player.leaderstats currency1.Value = ds1:GetAsync(player.UserId) or 0 local currency2 = Instance.new("NumberValue") currency2.Name = 'Rebirths' currency2.Parent = player.leaderstats currency2.Value = ds2:GetAsync(player.UserId) or 0
end)
There’s multiple syntax errors in your script, but I think the one messing you up is the typo of ‘function’. Below should be the fixed version.
local players = game:GetService("Players") local datastore = game:GetService("DataStoreService") local ds1 = datastore:GetDataService("ClickData") local ds2 = datastore:GetDataService("RebirthData") players.PlayerAdded:Connect(function(player) local folder = Instance.new("Folder") folder.Name = "leaderstats" folder.Parent = player local folder2 = Instance.new("Folder") folder2.Name = "Stats" folder2.Parent = players local currency1 = Instance.new("NumberValue") currency1.Name = 'Clicks' currency1.Parent = player.leaderstats currency1.Value = ds1:GetAsync(player.UserId) or 0 local currency2 = Instance.new("NumberValue") currency2.Name = 'Rebirths' currency2.Parent = player.leaderstats currency2.Value = ds2:GetAsync(player.UserId) or 0 end)