Hi, I made a few edits to the ROBLOX wiki custom chat gui and the one edit I made was when a certain player (In this case Player1) chatted he had rainbow text. That worked fine, but when he sent another text the first text wouldn't be rainbow anymore and the new text would be rainbow but the colors would change a lot faster. Can you please help?
script:
function rainbowtext()
while true do
wait(.1)
newchatline.TextColor3 = Color3.new(0/255, 128/255, 1)
wait(.1)
newchatline.TextColor3 = Color3.new(33/255, 136/255, 157/255)
wait(.1)
newchatline.TextColor3 = Color3.new(78/255, 151/255, 59/255)
wait(.1)
newchatline.TextColor3 = Color3.new(175/255, 208/255, 37/255)
wait(.1)
newchatline.TextColor3 = Color3.new(253/255, 221/255, 0/255)
wait(.1)
newchatline.TextColor3 = Color3.new(231/255, 130/255, 48/255)
wait(.1)
newchatline.TextColor3 = Color3.new(197/255, 35/255, 20/255)
wait(.1)
newchatline.TextColor3 = Color3.new(97/255, 39/255, 123/255)
end
end
function NewLabel(parent, msg, player)
newchatline = Instance.new("TextLabel", parent)
newchatline.Size = UDim2.new(1,0,0,30)
newchatline.Position = UDim2.new(0,0,1,-30)
newchatline.Font = "SourceSansBold"
newchatline.TextStrokeTransparency = 0
newchatline.BackgroundTransparency = 1
newchatline.BorderSizePixel = 0
newchatline.FontSize = "Size18"
newchatline.TextXAlignment = "Left"
newchatline.TextYAlignment = "Top"
newchatline.ClipsDescendants = true
newchatline.Name = "line1"
if player.Name == "Player1" then
newchatline.Text = "[Owner]"..player.Name..": "..msg
rainbowtext()
else
newchatline.TextColor3 = Color3.new(1,1,1)
newchatline.Text = player.Name.. ": " ..msg
end
end
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 == "5" then
v:Destroy()
else
v.Name = "line"..tostring(tonumber(LineNumber) + 1)
v.Position = v.Position - UDim2.new(0,0,0,25)
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)
UpdateOldLabels(game:GetService("StarterGui").ScreenGui.Frame)
NewLabel(v:WaitForChild("PlayerGui").ScreenGui.Frame, msg, player)
NewLabel(game:GetService("StarterGui").ScreenGui.Frame, msg, player)
end
end)
end)

1 comment
Ah thank you so much!