Custom Chat GUI: How to fix Clone Nil error?
Asked by
7 years ago Edited 7 years ago
Hello. I'm getting an error of 12:20:25.932 - Players.SilverCreeper58.PlayerGui.CustomChat.ChatFrame.ChatBar.TriggerChatSend:16: attempt to call method 'Clone' (a nil value)
. I don't understand how you can fix this.
Here's the Script (regular):
01 | plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait() |
02 | char = plr.Character or plr.CharacterAdded:Wait() |
03 | plrgui = plr.PlayerGui or plr.WaitForChild( "PlayerGui" ) |
04 | chatbox 6 = script.Parent.Parent.MsgChatFrame.chatbox 6 |
06 | script.Parent.msgbar.FocusLost:Connect( function (enter) |
08 | script.Parent.Parent.MsgChatFrame.chatbox 1. Text = script.Parent.Parent.MsgChatFrame.chatbox 2. Text |
09 | script.Parent.Parent.MsgChatFrame.chatbox 2. Text = script.Parent.Parent.MsgChatFrame.chatbox 3. Text |
10 | script.Parent.Parent.MsgChatFrame.chatbox 3. Text = script.Parent.Parent.MsgChatFrame.chatbox 4. Text |
11 | script.Parent.Parent.MsgChatFrame.chatbox 4. Text = script.Parent.Parent.MsgChatFrame.chatbox 5. Text |
12 | script.Parent.Parent.MsgChatFrame.chatbox 5. Text = script.Parent.Parent.MsgChatFrame.chatbox 6. Text |
13 | script.Parent.Parent.MsgChatFrame.chatbox 6. Text = script.Parent.msgbar.Text |
14 | script.Parent.msgbar.Text = "Tap the \"/\" button or click here to chat" |
15 | chatbox 6. Text = " " ..char.Name.. ": " ..chatbox 6. Text |
16 | script.Parent.Parent.MsgChatFrame.chatbox 1. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 1. Text |
17 | script.Parent.Parent.MsgChatFrame.chatbox 2. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 2. Text |
18 | script.Parent.Parent.MsgChatFrame.chatbox 3. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 3. Text |
19 | script.Parent.Parent.MsgChatFrame.chatbox 4. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 4. Text |
20 | script.Parent.Parent.MsgChatFrame.chatbox 5. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 5. Text |
21 | script.Parent.Parent.MsgChatFrame.chatbox 6. Text:Clone().Parent = plrgui.CustomChat.ChatFrame.MsgChatFrame.chatbox 6. Text |
This just checks if the player has pressed enter. Then when the message goes through, all the messages go up by one chatbox space. After that, it "should" clone them and put it in the PlayerGui.
Yes I know... it doesn't look the best, but whatever. This is the script. I know it has something to do with lines 16 - 21.