This is how I have my ScreenGui and ScrollingFrame set up. I have an idea: When any player in the game chats into the chat, it will change the text of a TextLabel onto the ScrollingFrame. The only thing I'm stuck on is how to make a new TextLabel every time a player chats, and how to make it not overlap eachother.
for i,v in pairs(game:GetService("Players"):GetChildren()) do v.Chatted:Connect(function(msg) -- I'm stuck here. end) end
Could I get some help please?
In order to create new TextLabels, you would simply use Instance.new() or :Clone a pre-existing one.
local newlabel = Instance.new("TextLabel", script.Parent.Frame) newlabel.Text = msg newlabel.Position = UDim2.new(0, 0, 0, 0)
This simply changes the new TextLabel's text to whatever the last message.
Second, in order to move all the TextLabels downwards, you would have a 'for loop' that would take all the labels and position them downwards. This should go BEFORE the above code.
local messages = script.Parent.Frame:GetChildren() -- Where ever textlabels are stored for a = 1, #messages do messages[a].Position = messages[a].Position + UDim2(0, 0, 0, 0) end
The code here is not reliable so i'd advise you to not directly copy it but improve upon it. Also the note the positioning depends on the size of your text labels, which is up to you. Good luck.