local Player=game.Players.LocalPlayer repeat wait() until game.Players.LocalPlayer game.Players.PlayerAdded:connect(function(Plr) AllPlayers=Plr.Parent:GetChildren() end) repeat wait() until Player.PlayerGui.ScreenGui local Frame=Player.PlayerGui.ScreenGui.Frame --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AllPlayers.Chatted:connect(function(Msg) Frame.Ten.Text=Frame.Nine.Text Frame.Nine.Text=Frame.Eight.Text Frame.Eight.Text=Frame.Seven.Text Frame.Seven.Text=Frame.Six.Text Frame.Six.Text=Frame.Five.Text Frame.Five.Text=Frame.Four.Text Frame.Four.Text=Frame.Three.Text Frame.Three.Text=Frame.Two.Text Frame.Two.Text=Frame.One.Text Frame.One.Text=Msg end)
I'm trying to make a chat system like the one that is already on ROBLOX, except longer. This is in a localscript inside of StarterPack. The error I get is Attempt to index global 'AllPlayers' (a nil value), and the error is on line 12
Try this:
local Player=game.Players.LocalPlayer repeat wait() until game.Players.LocalPlayer game.Players.PlayerAdded:connect(function(Plr) AllPlayers=Plr.Parent:FindFirstChild:GetChildren() end) repeat wait() until Player.PlayerGui.ScreenGui local Frame=Player.PlayerGui.ScreenGui.Frame --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AllPlayers.Chatted:connect(function(Msg) Frame.Ten.Text=Frame.Nine.Text Frame.Nine.Text=Frame.Eight.Text Frame.Eight.Text=Frame.Seven.Text Frame.Seven.Text=Frame.Six.Text Frame.Six.Text=Frame.Five.Text Frame.Five.Text=Frame.Four.Text Frame.Four.Text=Frame.Three.Text Frame.Three.Text=Frame.Two.Text Frame.Two.Text=Frame.One.Text Frame.One.Text=Msg end)
For line 5, I added "FindFirstChild" so that the script has time to find the Player's items.