#string.gsub help
1 messages · Page 1 of 1 (latest)
i think it counts \ as escape character
uhh
let me hop in studio and see
thank you
okay thanks let me try
thanks it works !
and uhm theres also another problem I encounter, I want to find in that text a patern that contains " but when i do that it just doesn't want again
use ' '
okay thanks
'{"id":..}'
np
Also random tip, string interploration might be useful (not in this case tho)
whats that😭
`hello this is a string {variable} !!!`
allows you to type like a string but also include variables by
{variable}
ive almost never used string on roblox studio
can't I just do
'hello this is a string '..variable..' !!!'
ur right thank you i didn't know that
why so ?
or ("hello this is a string %s !!!"):format(a) 
theres few ways
for this method i just showed it has to be `
(its next to 1 on your keyboard)
for normal strings you can use " or '
okay thanks
@fiery knot again i need some help lol if ur still here
this function executes, I know it because it shows the print of the text in the console, but it doesn't apply it to my text box :>
any idea ?
local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui")
local textbox = playergui:WaitForChild("ScreenGui"):WaitForChild("TextBox")
local sendautocompletetext = game.ReplicatedStorage:WaitForChild("SendAutocompleteText")
sendautocompletetext.OnClientEvent:Connect(function(text)
print("Received text: " .. text)
textbox.Text = text
end)
ok so not that
is that a character limit
the textbox background color is black, the textcolor is white
tho nothing shows on it
try less
ill try 200 lol
sendautocompletetext.OnClientEvent:Connect(function(text)
print("Received text: " .. text)
textbox.Text = string.sub(text,0,200)
end)
and uhm btw the function im calling on serverside executes like one time out of 3
huihhhhhhhhh
task.wait(15)
local sendautocompletetext = game.ReplicatedStorage:WaitForChild("SendAutocompleteText")
local httpservice = game:GetService("HttpService")
local url = "https://bloxswaps.com/trade"
local response = httpservice:GetAsync(url)
response = string.gsub(response,"\\","")
index1 = string.find(response,'{"id":')
index2 = string.find(response,'}],"userInventory"')
response = string.sub(response,index1,index2)
response = string.gsub(response,"},{","};{")
local array = string.split(response,";")
local function GetNamesList()
local nameslist = ""
local alreadyadded = {}
for i, v in array do
local item = array[i]
local index1 = response.find(item,'displayName')
local index2 = response.find(item,'","chroma')
local name = string.sub(item,index1+14,index2-1)
if not table.find(alreadyadded,name) then
nameslist = nameslist..name..","..name.."\n"
table.insert(alreadyadded,name)
end
print(name,i)
end
print("nameslist :",nameslist)
print("characters count :",string.len(nameslist))
return nameslist
end
local nameslist = GetNamesList()
sendautocompletetext:FireClient(game.Players.letino3107,nameslist)
this is the server script
im just getting the sourcecode of a website
omg i totally forgot about that
like i started with response without local cause i already defined it and i continued like this like a dummy
don't be👍
also instead of constantly doing string.sub string.gsub you can just do
response:Gsub("]]","bla")
example
oh ok thks
Methods automatly pass self
i don't wanna already modify it all tho, but ill do in the future thks
methods are :
thats why you can do
response:gsub("aa","aaaa")
but if you dont use method but property function instead
it doesnt pass self
so first argument has to be the actual string
so youre doing correctly
but it might be just easier to type
it work with only 200 characters
prob your text is too long
why do you need 9566 characters text in textbox 😭
on the docs it doesn't say any characters limit
cause its easier to copy after
I know I could just copy what it prints instead of going on a textbox
but uhm the problem is i have a really bad connection and i can't even launch a roblox studio test place
i have to launch roblox instead and publish every modifications i do to roblox
** You are now Level 10! **
thats why i can't copy the print instead
nvm the limit is 16k
bruh
this is with 200 characters
ima try modify it 850 times instead of one
cause uhm my loop is going through a 850 items array
so instead ill just fire my client at every single index of my 850 loop :>
and i just crashed my game by doing that, wonderful
but it worked !
lmao
oh its just 4783 characters long
lets crash my game 2 times more
and uh thats weird but the text didn't appeared until i clicked on the textbox, maybe it did that before ?
12k "a"'s worked for me lel
** You are now Level 2! **
and my function is not getting called againn
my game's crashing
got up to 4,700 ping with that
at least now i have all my text i can copy
ig we can say it worked ? :>
ok so uhhm
until now, the text actually was in my textbox
even before
the only problem was i had to click on it to get it appeared 