How do I replace the default chat GUI?
Iv'e got my chat gui working now, but the default chat appears over it. how do I fix this? Here's the code for reference:
01 | function UpdateOldLabels(Parent) |
02 | for i,v in pairs (Parent:GetChildren()) do |
03 | if v.Name:sub( 1 , 4 ):lower() = = "line" then |
04 | local LineNumber = v.Name:sub( 5 ) |
05 | if LineNumber = = "12" then |
08 | v.Name = "line" .. tostring ( tonumber (LineNumber) + 1 ) |
09 | v.Position = v.Position - UDim 2. new( 0 , 0 , 0 , 25 ) |
15 | game:GetService( "Players" ).PlayerAdded:connect( function (player) |
16 | player.Chatted:connect( function (msg) |
17 | for _,v in ipairs (game:GetService( "Players" ):GetChildren()) do |
18 | UpdateOldLabels(v:WaitForChild( "PlayerGui" ).ScreenGui.Frame) |
19 | newchatline = Instance.new( "TextLabel" ,v:WaitForChild( "PlayerGui" ).ScreenGui.Frame) |
20 | newchatline.Text = player.Name.. ": " ..msg |
21 | newchatline.Size = UDim 2. new( 1 , 0 , 0 , 25 ) |
22 | newchatline.Position = UDim 2. new( 0 , 0 , 1 ,- 25 ) |
23 | newchatline.Font = "SourceSans" |
24 | newchatline.TextColor 3 = Color 3. new (math.random(), math.random(), math.random()) |
25 | newchatline.TextStrokeTransparency = 0.5 |
26 | newchatline.TextStrokeColor 3 = Color 3. new (math.random(), math.random(), math.random()) |
27 | newchatline.BackgroundTransparency = 1 |
28 | newchatline.BorderSizePixel = 0 |
29 | newchatline.FontSize = "Size24" |
30 | newchatline.TextXAlignment = "Left" |
31 | newchatline.TextYAlignment = "Top" |
32 | newchatline.ClipsDescendants = true |
33 | newchatline.Name = "line1" |
34 | newchatline.TestWrapped = true |
36 | UpdateOldLabels(game:GetService( "StarterGui" ).ScreenGui.Frame) |
37 | newchatline:Clone().Parent = game:GetService( "StarterGui" ).ScreenGui.Frame |