I’m making a plugin that responds to command such as while1
and replaces it with while task.wait(1) do
, but there’s one issue, it only loop until the second line instead of throughly looping the script
If you still don’t know what i’m talking about, this
line 1: while1 -- works
line 2: while4 -- works
line 3: while1 -- doesn't work at all
turns into (i deleted the end)
temporarely)
line 1: while task.wait(1) do
line 2: while task.wait(4) do
line 3: while1
I tried to do something like this but to no avail
local previousSource = src.Source
src:GetPropertyChangedSignal("Source"):Connect(function()
local source = src.Source
local lines = source:split("\n")
local line, index
for i, x in previousSource:split("\n")
for j, y in lines do
if x ~= y then
line = y
index = x
break
end
end
end
print(line, index)
previousSource = src.Source
end)
At this point i gave up and yet here we are.
Like the title says, How do i get the current line edited in a script