I'm attempting to create some commands, however, I am getting the error of "unfinished string near ''".

The script is as follows.

players = {
	['3610599'] = {
		name = 'DeadToMe';
		id = 3610599;
		
		rank = 5;
		title = 'Owner';
	};
};


function playerHandler(player)
	local data = players[tostring(player.userId)];
	
	if (data) then
		if (data.banned) then
			player:Kick();
			
			print('Kicked player ' .. player.Name .. '(id: ' .. player.userId .. '): banned.');
		else
			print('Found data for player ' .. player.Name .. '(id: ' .. player.userId .. ').');
		end;
	else
		players[tostring(player.userId)] = {
			name = player.Name;
			id = player.userId;
			
			rank = 0;
			title = 'Guest';
		};
		
		print('Created data for player ' .. player.Name .. '(id: ' .. player.userId .. ').');
	end;
	
	player.Chatted:connect(function(msg)
		print(msg);
	end);
end;


for _, player in pairs(game:GetService('Players'):GetPlayers()) do
	playerHandler(player);
end;

EDIT: The following causes the same error.

players = { };

2 comments

1

Not sure what you are talking about. This code is not giving me any errors.

0

I don't know why exactly it is giving me the error. It shouldn't give me any error. alas, it is.