So what I've been trying to do is whenever I say c/ it says running a script but it doesn't seem to space out the textlabels in the output. Can somebody please try to help me? I want it so that the text labels space out each time in my output. My own custom made one so that they don't overlap onto each other. I've tried adding the position but it doesn't seem to work.
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) if msg:lower():sub(1,2) == "c/" then local code = loadstring(msg:sub(3)) code() local t = Instance.new("TextLabel",player:findFirstChild("PlayerGui").Output.Main) t.BackgroundTransparency = 1 --UDim2.new(xscale,xoffset,yscale,yoffset) t.Size=UDim2.new(0,200,0,50) t.Text="Running a Script(Workspace.Script)" t.TextWrapped=true t.Position=UDim2.new(0,4,0,2) t.Position=t.Position+UDim2.new(0,8,0,4) t.TextColor3=Color3.new(0,170,255) t.Visible = true pcall(function() end) pcall(function() end) end end) end)
If your Output.Main
contains only the output TextLabel
s, you can use the length of table of it's children and multiply that number by Y Offset
that you use. Since you are parenting them before the calculation, just decrease the length by 1.
local numLabels = #player.PlayerGui.Output.Main:GetChildren() - 1 t.Position = UDim2.new(0, 4, 0, 2) + UDim2.new(0, 0, 0, numLabels * 50) -- initial position and offset
If Output.Main
contains other Instance
s as well, you can use a counter variable of sorts, which you increment every time a TextLabel
is added. Or, you can filter out the Instance
s to get only the Output.Main
s TextLabel
s.
Hope this helped.