Replacing items in a string

You can use gusb

local ex = "Hello world" -- this is the string we want to remove the stuff from
local word = 'world' -- this is the string we want to remove from ex
local replace = "" -- this is the string we want to replace the word(s) with

ex = string.gsub(ex, word, replace)
print(ex) -> Hello

Also for the word, it can actually be as many words, phrases, etc as you like.
if you leave replace as “” or blank, it will basically just remove it,
but if replace was like “Tomato” ex would print Hello Tomato.

1 Like