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

ServerScriptService.Stats:7: Expected ')' (to close '(' at line 6), got 'local'?

Asked by 3 years ago
Edited 3 years ago

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)

0
Could you please fix the code block? It's really hard to read it this way. ColdFoxy07 76 — 3y
0
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. alexandruboc22 12 — 3y
0
It don't let me type it all Idk how to fix it alexandruboc22 12 — 3y
0
Nvm fixed it but becarful when reading it XD alexandruboc22 12 — 3y
View all comments (2 more)
0
With fixing I meant putting all the code in one lua block. It's all over the place now and it's pretty hard to read it this way. ColdFoxy07 76 — 3y
0
You have a syntax error somewhere, specifically, a parentheses that is not closed OfficerBrah 494 — 3y

1 answer

Log in to vote
0
Answered by
jundell 106
3 years ago
Edited 3 years ago

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)
0
Please, next time use codeblocks! jundell 106 — 3y
Ad

Answer this question