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)
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.