There is no error in the output and i dont know why its not working so i was wondering if someone could help. --this script is in workspace
players = game.Players:GetChildren() game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) for i = 1,#players do chatbox = script.Chat:Clone()--clones a gui in the script chatbox.Text = player.Name-- changes the name of the gui to the players name chatbox.ChatText = msg-- changes the text guis name space = players[i].PlayerGui.Chat.ChatSpace--gets the players space for chats chatbox.Parent = space--puts the chat in the chatspace end end) end)
The problem is on line 1. You are getting the players that exist when the script is first run. The script first runs when the game starts. This means there will be no players in the game when the script runs and the players
variable will be an empty table. Move line 1 inside the Chatted
event handler to fix this problem.
Good luck!