So, my main question is why is it only taking the top name, Player1 and making it so that is the only value in the table, it doesn't check the other 2 values, Player2, or Player3.
--Tables ( Right now my script is wrong, it only takes the top name, if you're fatul, cryo, or player1 your name is still white. )
local MainPeople = {
"Player1";
"Player2";
"Player3";
}
--Variables
local Sc = workspace.Events.ServerC
local S1 = Sc.Text1
local S2 = Sc.Text2
local S3 = Sc.Text3
local S4 = Sc.Text4
local S5 = Sc.Text5
local S6 = Sc.Text6
local S7 = Sc.Text7
local S8 = Sc.Text8
local S9 = Sc.Text9
--Main? Functions
script.Parent.OnServerEvent:connect(function(player, msg)
S1.Text = S2.Text S1.TextColor3 = S2.TextColor3
S2.Text = S3.Text S2.TextColor3 = S3.TextColor3
S3.Text = S4.Text S3.TextColor3 = S4.TextColor3
S4.Text = S5.Text S4.TextColor3 = S5.TextColor3
S5.Text = S6.Text S5.TextColor3 = S6.TextColor3
S6.Text = S7.Text S6.TextColor3 = S7.TextColor3
S7.Text = S8.Text S7.TextColor3 = S8.TextColor3
S8.Text = S9.Text S8.TextColor3 = S9.TextColor3
player.Chatted:connect(function(msg)
for i,v in pairs(MainPeople) do
wait(.05) -- I don't even know what this wait did but it made doubles stop happening so I'm leaving it there.
if player.Name:lower() == MainPeople[i]:lower() then
S9.Text = player.Name .. ": " .. msg
S9.TextColor3 = Color3.new(0,0,0)
return
elseif player.Name:lower() ~= MainPeople[i]:lower() then
S9.Text = player.Name .. ": " .. msg
S9.TextColor3 = Color3.new(255,255,255)
return end
end
end)
end)
My goal is to make it so when Player1, 2 and 3 talk their name is a different color than Player4. (This is a custom chat gui!)
