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

"expected identifier, got ')' may you help me?

Asked by 5 years ago
Edited 5 years ago

the error is on the last line. it says "expected identifier, got ')' please help me

SmoothBlockModel = script.Parent
game.Players.PlayerAdded:connect(
    function(player)
        local ls = Instance.new("IntValue",plr)
        local leaderstats = Instance.new("Model")
        leaderstats.Name = "leaderstats"
        leaderstats.Parent = player 
        local money = Instance.new("IntValue") 
        money.Name = "Score" 
        money.Value = 0 
        money.Parent = leaderstats
    end)

SmoothBlockModel.Touched:Connect(function(hit)
    for _, player in ipairs()(game.Players:GetPlayers()) do
    player.leaderstats.Score.Value = player.leaderstats.Score.Value + 1
    wait(1)
end)        
2
Add an 'end' between line 17 and 18. You never ended the for loop, so the script read it wrong. Pojoto 329 — 5y

1 answer

Log in to vote
0
Answered by
Kev_nn 4
5 years ago

All loops and statements must have an end to them. You must have forgotten to put an end for the for loop.

A correct version of your script would be this:

SmoothBlockModel = script.Parent
game.Players.PlayerAdded:connect(function(player)
    local ls = Instance.new("IntValue",plr)
    local leaderstats = Instance.new("Model")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player
    local money = Instance.new("IntValue")
    money.Name = "Score"
    money.Value = 0
    money.Parent = leaderstats
end)

SmoothBlockModel.Touched:Connect(function(hit)
    for _, player in ipairs()(game.Players:GetPlayers()) do
        player.leaderstats.Score.Value = player.leaderstats.Score.Value + 1
        wait(1)
    end
end) 

Hope this helps.

0
thanks! was thinking i needed another end! SodaZere 31 — 5y
Ad

Answer this question