The chat works perfectly fine when only one person is in the server, when there is more than one person the script does not run past line 62/84(depending on whether or not I am the one chatting). It allows you to chat once but it'll only show up for you and then it will refuse to run past line 62/84 when it's supposed to be putting the message in the other people's PlayerGuis. I am not sure how I'd fix this, it must have something to do with the WaitForChild() or the for loop. Anybody have any ideas how to fix this problem? There was no output other than the prints
wait(1)
player = game.Players.LocalPlayer
chat = player.PlayerGui.FalseChat
posted = 0
disabled = false
running = false
local entered = nil
function NewLine(enterPressed)
if running == false and chat.Enter.Visible == true then
running = true
if (enterPressed) then
entered = chat.Enter.Text
if posted >= 4 and disabled == false then
chat.Enter.Visible = false
chat.Shadow.Visible = false
local newestmsg = game.Lighting.ServerMessage:Clone()
disabled = true
newestmsg.Message.Text = "[SERVER]: Your chat has been disabled for 60 seconds because you were chatting too quickly."
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat.OldMsg.Name = "OlderMsg"
end
wait()
if chat.Chat:FindFirstChild("NewMsg", true) then
chat.Chat.NewMsg.Name = "OldMsg"
end
wait()
newestmsg.Name = "NewMsg"
newestmsg.Parent = chat.Chat
for i = 1, 60 do
wait(1)
running = true
entered = nil
end
chat.Enter.Visible = true
chat.Shadow.Visible = true
local newermsg = game.Lighting.ServerMessage:Clone()
disabled = false
newermsg.Message.Text = "[SERVER]: Your chat has been reactivated. Please chat slower."
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat.OldMsg.Name = "OlderMsg"
end
wait()
if chat.Chat:FindFirstChild("NewMsg", true) then
chat.Chat.NewMsg.Name = "OldMsg"
end
wait()
newermsg.Name = "NewMsg"
newermsg.Parent = chat.Chat
end
if chat.Enter.Text == "Click here or push '/' to talk..." or chat.Enter.Text == " " or chat.Enter.Text == "" or chat.Enter.Text == nil then
entered = nil
running = false
elseif entered ~= nil and disabled == false and posted < 4 then
if string.len(entered) <= 100 then
if entered ~= nil and chat.Enter.Visible == true then
posted = posted + 1
if player.Name == "FearMeIAmLag" then
for i, v in pairs(game.Players:GetChildren()) do
wait()
print("begin waiting")
local chat = v:WaitForChild("PlayerGui").FalseChat.Chat
local newestmsg = game.Lighting.OwnerMessage:Clone()
print("Cloned")
newestmsg.Message.Text = player.Name..": "..entered
if chat:FindFirstChild("OldMsg", true) then
chat.OldMsg.Name = "OlderMsg"
chat.NewMsg.Name = "OldMsg"
end
wait()
if chat:FindFirstChild("NewMsg", true) then
chat.NewMsg.Name = "OldMsg"
end
wait()
newestmsg.Name = "NewMsg"
print("posting")
newestmsg.Parent = chat
end
print("Completed copying")
else
for i, v in pairs(game.Players:GetChildren()) do
wait()
print("begin waiting")
local chat = v:WaitForChild("PlayerGui").FalseChat.Chat
local newestmsg = game.Lighting.UserMessage:Clone()
newestmsg.Message.Text = player.Name..": "..entered
if chat:FindFirstChild("OldMsg", true) then
chat.OldMsg.Name = "OlderMsg"
chat.NewMsg.Name = "OldMsg"
end
if chat:FindFirstChild("NewMsg", true) then
chat.NewMsg.Name = "OldMsg"
end
wait()
newestmsg.Name = "NewMsg"
newestmsg.Parent = chat
end
print("Completed copying")
end
chat.Enter.Text = "Click here or type '/' to talk..."
end
else
chat.Enter.Text = "There is a 100 character limit..."
wait(5)
chat.Enter.Text = "Click here or push '/' to talk..."
end
end
end
chat.Enter.Text = "Click here or push '/' to talk..."
end
running = false
entered = nil
end
chat.Chat.ChildAdded:connect(function()
if chat.Chat:FindFirstChild("NewMsg", true) then
chat.Chat.NewMsg.Message.Size = UDim2.new(0, 350, 0, chat.Chat.NewMsg.Message.TextBounds.Y)
wait()
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat:TweenSize(UDim2.new(0, 400, 0, chat.Chat.Size.Y.Offset + chat.Chat:FindFirstChild("OldMsg").Message.Size.Y.Offset + 2), "Out", "Quad", .5, false)
chat.Chat:TweenPosition(UDim2.new(0, 20, 0, -chat.Chat.Size.Y.Offset + 124 - chat.Chat:FindFirstChild("OldMsg").Message.Size.Y.Offset), "Out", "Quad", .5, false)
end
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat.NewMsg.Position = UDim2.new(0,0,0, chat.Chat:FindFirstChild("OldMsg").Position.Y.Offset + chat.Chat:FindFirstChild("OldMsg").Message.Size.Y.Offset + 2)
else
chat.Chat.NewMsg.Position = UDim2.new(0,0,0,0)
end
wait()
print("posted")
end
end)
chat.Enter.FocusLost:connect(function(enterPressed)
if disabled == false and running == false and chat.Enter.Visible == true then
NewLine(enterPressed)
end
end)
player:GetMouse().KeyUp:connect(function(key)
if string.char(47) == key then
chat.Enter:CaptureFocus()
end
end)
--[[game.Players.ChildAdded:connect(function(newPlayer)
local newestmsg = game.Lighting.ServerMessage:Clone()
disabled = true
newestmsg.Message.Text = "[SERVER]: "..newPlayer.Name.." has joined the server!"
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat.OldMsg.Name = "OlderMsg"
end
wait()
if chat.Chat:FindFirstChild("NewMsg", true) then
chat.Chat.NewMsg.Name = "OldMsg"
end
wait()
newestmsg.Name = "NewMsg"
newestmsg.Parent = chat.Chat
end)
game.Players.ChildRemoved:connect(function(newPlayer)
local newestmsg = game.Lighting.ServerMessage:Clone()
disabled = true
newestmsg.Message.Text = "[SERVER]: "..newPlayer.Name.." has left the server"
if chat.Chat:FindFirstChild("OldMsg", true) then
chat.Chat.OldMsg.Name = "OlderMsg"
end
wait()
if chat.Chat:FindFirstChild("NewMsg", true) then
chat.Chat.NewMsg.Name = "OldMsg"
end
wait()
newestmsg.Name = "NewMsg"
newestmsg.Parent = chat.Chat
end)]]
while wait(5) do
if posted > 0 then
posted = posted - 1
end
end

2 comments
Thats allloooootttttt of code to read through...
I directed you to line 62/84 because that is where I believe the problem lies. I only provided the whole code because it may be required.