Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

someone help with my chat gui?

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)

2 comments

0

You will get more help if you take the time to make your question legible. Place code within a code block. The code you placed in your question includes comments which can't be distinguished from your code.

0

it glitched i remember putting it in the code block.

1 answer

✓ Accepted answer

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!

This discussion is preserved as it was. New answers, comments, and votes are closed.