#can anyone tell me the name of this thing?
20 messages · Page 1 of 1 (latest)
whats that?
oh ok
just like the print(iforgor.Name)?
string.find(str,comp) takes in a string, which is str, in this case, and looks for any instance of another string, comp, in this case, within str
if it isn't found it returns nil, or nothing, and if it is found, it returns the index of where comp first appears in str
so something like
local index = string.find("ABCDEFG","F")
print(tostring(index))
would print 6, since that's where the first occurrence of F is in the string
ok
local index = string.find("ABCABCABC","B")
print(tostring(index))
it only finds the first occurrence though
so something like this would print 2, since the first place it found the letter B in str is at index 2.
you could use this to delete every object that has a certain string in its name
for _,v in pairs(workspace:GetDescendants())
if string.find(v.Name,"Vest") then
v:Destroy()
end
end
okie dokie