I have a chat script that I want to modify to have the messages white but player names colored like the default style. I have the textlabels set up how I want them to be but I'm having trouble setting them up to work probably...
What I'm trying to get here is Player is Colorable but Messages stay one color not the same as a player color . I have the textlabels named Player and Text how can I link text to this script?
local chats = script.Parent.Chats
local last
function newChat(msg,plr)
if #msg > 0 then
for i, c in pairs(chats:GetChildren()) do
c.Position = c.Position - UDim2.new(0, 0, 0.1, 0)
end
local newMessage = script.player:clone()
if #chats:GetChildren() == 10 then
chats:GetChildren()[1]:Destroy()
end
if plr:GetRankInGroup(782018) >= 150 then
newMessage.TextColor3 = script.Owner.Value
newMessage.Text = "[Owner] " .. plr.Name ..": ".. msg -- I'm trying to get this to be a separate color then the same as the player...
elseif plr.Name == "" then
newMessage.TextColor3 = script.Owner.Value
newMessage.Text = "[Moderator] " .. plr.Name ..": ".. msg
elseif plr.Name == "" or plr.Name == "" or plr.Name == "" then
newMessage.TextColor3 = script.NOOB.Value
newMessage.Text = "[NOOB] " .. plr.Name ..": ".. msg
elseif game:GetService("GamePassService"):PlayerHasPass(plr, 190080550)then
newMessage.TextColor3 = script.MegaVIP.Value
newMessage.Text = "[MegaVIP] " .. plr.Name ..": ".. msg
elseif game:GetService("GamePassService"):PlayerHasPass(plr, 174701215)then
newMessage.TextColor3 = script.VIP.Value
newMessage.Text = "[VIP] " .. plr.Name ..": ".. msg
else
newMessage.Text = plr.Name ..": ".. msg
end
newMessage.Position = UDim2.new(0, 0, 0.9, 0)
newMessage.Parent = chats
last = newMessage
end
end
function join(plr)
for i, c in pairs(chats:GetChildren()) do
c.Position = c.Position - UDim2.new(0, 0, 0.1, 0)
end
local newMessage = script.Message:clone()
if #chats:GetChildren() == 10 then
chats:GetChildren()[1]:Destroy()
end
newMessage.Text = "[CONSOLE] " .. plr.Name .. " Joined the game"
newMessage.TextColor3 = script.CONSOLE.Value
newMessage.Position = UDim2.new(0, 0, 0.9, 0)
newMessage.Parent = chats
last = newMessage
end
function left(plr)
for i, c in pairs(chats:GetChildren()) do
c.Position = c.Position - UDim2.new(0, 0, 0.1, 0)
end
local newMessage = script.Message:clone()
if #chats:GetChildren() == 10 then
chats:GetChildren()[1]:Destroy()
end
newMessage.Text = "[CONSOLE] " .. plr.Name .. " Left the game"
newMessage.TextColor3 = script.CONSOLE.Value
newMessage.Position = UDim2.new(0, 0, 0.9, 0)
newMessage.Parent = chats
last = newMessage
end
game.Players.PlayerAdded:connect(function(plr)
join(plr)
end)
game.Players.PlayerRemoving:connect(function(plr)
left(plr)
end)
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
newChat(msg, plr)
end)
end)
for i, player in pairs(game.Players:GetPlayers()) do
player.Chatted:connect(function(msg)
newChat(msg, player)
end)
end

1 comment
I already created the textlabels it works for one but im trying to add fhe other too it, the hirchery is this ScreenGui>script(color3vaules,player,text)>Chats Im trying to get text to work alongside player i tried what i thought would work but failed...