String.Split not working?

Hello.

I am unsure of what I’ve done wrong so far, but my prints seem to return nil or -, instead of the actual split. (The first print(Message); does work properly.)

repeat wait() until game:GetService("Players").LocalPlayer.Character;

game:GetService("Players").LocalPlayer.Chatted:Connect(function(Message)
	print(Message);
	print(Message.split(" ")[1]);
	print(Message.split(" ")[2]);
end)

Use a colon instead of a period. When you use a period, you have to pass the string as the first parameter.

1 Like