So I have a textbox and a textbutton.
When I click the textbutton I want the script below to check where a word begins and ends
But I get an error: attempted to index local Word (a number value)
How do I fix this?
function onClicked()
local Text = script.Parent.Parent.TextBox.Text
local Word = string.find(Text, "test")
local StartOfWord = Word[1]
local EndOfWord = Word[2]
print(EndOfWord)
print(StartOfWord)
end
script.Parent.MouseButton1Click:Connect(onClicked)

2 comments
line 3 isn't right, you need to define word another way..The format would be more like
if string.find(Text, "test") then..endYeah, that works, but then how do I find where it starts and ends?