Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)		

1 comment

2

Add an 'end' between line 17 and 18. You never ended the for loop, so the script read it wrong.

1 answer

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.

1 comment

0

thanks! was thinking i needed another end!

This discussion is preserved as it was. New answers, comments, and votes are closed.