DISCLAIMER this is for practice and none of this is intended to be used in a harmful way.
I am trying to make an in game script editor, however I was running into a rather odd issue. First let me show my code:
local function AddLine(num,text)
if Content:FindFirstChild(tostring(num)) then
else
local new = Template:Clone()
new.Name = num
new.N.Text = num
new.LayoutOrder = num
new.Parent = Content
at = num
new.CodeBox.Focused:Connect(function()
--at = tonumber(new.Name)
new.Bar.BackgroundTransparency = 0.8
end)
new.CodeBox.FocusLost:Connect(function(enter)
new.Bar.BackgroundTransparency = 1
if enter then
if Content:FindFirstChild(tostring(at+1)) then
--there is already a line after
Content:FindFirstChild(tostring(at+1)).CodeBox:CaptureFocus()
at += 1
else
--there is no line after
local after = AddLine(at+1)
after.CodeBox:CaptureFocus()
print(string.sub(after.CodeBox.Text,1,1))
end
end
end)
return new
end
end
When I add a new line, everything seems to work fine:
https://gyazo.com/69c25841cc5175104a90887d5ae9400b
However, in the video you will notice there is a small space appearing before my text in my new lines. Now the even weird part of this is they aren’t actually spaces, I found them to be equal to shift + enter.
How can I stop these from appearing before my text, I have tried everything like setting the text to “” when I create it but no matter what they always appear in my lines.