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

How Do I Make This Chat GUI Work?

Asked by 10 years ago

I am trying to make a Chat GUI but whenever I test it, it does full caps, the one line of text doesn't move when I type in another thing, it's nontransparent, there's a border, the text is tiny, and the color is wrong. Can anyone help?

function UpdateOldLabels(Parent)
    for i,v in pairs(Parent:GetChildren()) do
        if v.Name:sub(1,4):lower() == "line" then
            local LineNumber = v.Name:sub(5)
            if LineNumber == "12" then
                v:Destroy()
            else
                v.Name = "line"..tostring(tonumber(LineNumber) + 1)
                v.Position = v.Position - UDim2.new(0,0,0,15)
            end
        end
    end
end

game:getService("Players").PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        for _,v in ipairs(game:GetService("Players"):GetChildren()) do
            UpdateOldLabels(v:WaitForChild("PlayerGui").ScreenGui.Frame)
            newchatline = Instance.new("TextLabel",v:WaitForChild("PlayerGui").ScreenGui.Frame)
            newchatline.Text = player.Name.. ": " ..msg
            newchatline.Size = UDim2.new(1,0,0,15)
            newchatline.Position = UDim2.new(0,0,1,-15)
            newchatline.Font = "Arial"
            newchatline.TextColor3 = Color3.random()
            newchatline.TextStrokeTransparency = 0
            newchatline.BackgroundTransparency = 0.4
            newchatline.BorderSizePixel = 0
            newchatline.FontSize = "Size16"
            newchatline.TextXAlignment = "Left"
            newchatline.TextYAlignment = "Top"
            newchatline.ClipsDescendants = true
            newchatline.Name = "line1"
        end
        UpdateOldLabels(game:GetService("StarterGui").ScreenGui.Frame)
        newchatline:Clone().Parent = game:GetService("StarterGui").ScreenGui.Frame
    end)
end)

2 answers

Log in to vote
0
Answered by 10 years ago

you have inserted newchatline.TextColor3 = Color3.random() and Color3.random() isn't a function in studio so you can use colors by using an RGB code and the normal color string is newchatline.TextColor3 = Color3.new(1,1,1) so the script for normal would be

function UpdateOldLabels(Parent)
    for i,v in pairs(Parent:GetChildren()) do
        if v.Name:sub(1,4):lower() == "line" then
            local LineNumber = v.Name:sub(5)
            if LineNumber == "12" then
                v:Destroy()
            else
                v.Name = "line"..tostring(tonumber(LineNumber) + 1)
                v.Position = v.Position - UDim2.new(0,0,0,15)
            end
        end
    end
end

game:GetService("Players").PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        for _,v in ipairs(game:GetService("Players"):GetChildren()) do
            UpdateOldLabels(v:WaitForChild("PlayerGui").ScreenGui.Frame)
            newchatline = Instance.new("TextLabel",v:WaitForChild("PlayerGui").ScreenGui.Frame)
            newchatline.Text = player.Name.. ": " ..msg
            newchatline.Size = UDim2.new(1,0,0,15)
            newchatline.Position = UDim2.new(0,0,1,-15)
            newchatline.Font = "SourceSansBold"
            newchatline.TextColor3 = Color3.new(1,1,1)
            newchatline.TextStrokeTransparency = 0
            newchatline.BackgroundTransparency = 1
            newchatline.BorderSizePixel = 0
            newchatline.FontSize = "Size14"
            newchatline.TextXAlignment = "Left"
            newchatline.TextYAlignment = "Top"
            newchatline.ClipsDescendants = true
            newchatline.Name = "line1"
        end
        UpdateOldLabels(game:GetService("StarterGui").ScreenGui.Frame)
        newchatline:Clone().Parent = game:GetService("StarterGui").ScreenGui.Frame
    end)
end)

the gui would look like this MAKE SURE CHAT MODE IS ON BUBBLE OR IT WONT WORK

0
I think I know where the "Color3.random() from. I made an earlier post about it, and someone put it in to make the name colors random. Also, the color and transluency are fixed, but nothing else. DapperLink123 30 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Also make sure it is in ServerScriptService.

0
It is. DapperLink123 30 — 10y

Answer this question