Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help with my chat gui?

Asked by
Teeter11 281 Moderation Voter
10 years ago

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)

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.. nate890 495 — 10y
0
can you fix it for me? Teeter11 281 — 10y
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. nate890 495 — 10y
0
ok i found yours but i dont know how it works Teeter11 281 — 10y

1 answer

Log in to vote
-1
Answered by 10 years ago

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.

Ad

Answer this question