This one's a bit hard to explain, but i'll try. Lets say that there's a GUI that says "I love cats!". how would a script automatically find the word "cats"? and how could it replace it with "my cat"? Note that this example isn't exactly what i'm trying to do with it, so string.sub(8,11) would be useless
✓ ANSWER ACCEPTED
How do I find and replace text inside a string?
1 answer
✓ Accepted answer
use string.find! use this for more information: https://developer.roblox.com/en-us/api-reference/lua-docs/string
local stringfind = "cats are awesome!"
if string.find(stringfind) then
stringfind = "my cats are awesome!"
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
To add on to this, use GSUB to "replace" strings. For example, local string = "hello there human!" string:gsub("there","you"))
upvoted comment