String.split() help

I don’t know how to use string.split,

I currently have:

local text = "Hello World"
print(string.split(text, " "))

but it prints table:(then a bunch of number/letters)

I would like to know how to print Hello and World separately

local text = "Hello World"
local SPLIT = text:split(" ")
print(SPLIT[1]) --> "Hello"

Split returns you a table
[Another interesting way is to maybe use patterns and combine it with string.sub]

2 Likes

You don’t need to use split, just look at Strings | Roblox Creator Documentation

well that works already, just get em by parts with “[1]”, [“2”]

Thank you I have been looking everywhere

1 Like