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

Can someone help with my chat gui?

So i dont really know whats wrong so can someone please help?

21:15:55.691 - Players.Player1.PlayerGui.Chat.Chatted:3: attempt to index field 'PlayerGui' (a nil value) 21:15:55.692 - Script 'Players.Player1.PlayerGui.Chat.Chatted', Line 3 21:15:55.695 - stack end

wait(10)
players = game.Players:GetChildren()
chats = players.PlayerGui.Chat.ChatBounds:GetChildren()-- line 3
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
copy = script.Parent.ChatPlayer:Clone()
copy.Text = player.Name
copy.ChatText.Text = msg
copy.Position = UDim2.new(0,0,0,100)
for i = 1,#chats do
chats[i].Position = UDim2.new(0,0,0,chats[i].Position.Y.Offset - 20)
end

copy.Parent = players.PlayerGui.Chat.ChatBounds

end)
end)

4 comments

0

game.Players.PLAYER.PlayerGui not game.Players.PlayerGui and since players is a table and you are trying to index a nil value it wouldn't matter if you got the hierarchy wrong anyway. What you probably meant to do is make players = game.Players and make chats = game.Player.LocalPlayer.PlayerGui.Chat..

0

can you fix it for me?

0

Nope, I don't even understand how it's supposed to work. The only suggestion that I have is to recode it. I made a chat GUI awhile back that could be a decent reference if you can't fix it and end up restarting.

0

ok i found yours but i dont know how it works

1 answer

First of all PlayerGUI is nil, because the output says it doesn't exist because you're in studio mode. Second of all, where's the message? You'd need to add something like this, to it.

if msg:lower() == "PUT WHAT TO SAY HERE!!" then

Once you add that in the script, the GUI should work, unless I'm reading this wrong.

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