Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I space out my text labels in my custom made output?

Asked by 8 years ago

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)

1 answer

Log in to vote
0
Answered by 8 years ago

If your Output.Main contains only the output TextLabels, 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 Instances 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 Instances to get only the Output.Mains TextLabels.

Hope this helped.

0
Thank you a lot! My good friend. You response was so well educated. And full of knowledge! legomaster38 39 — 8y
Ad

Answer this question