2DWorlds Forums
onChatted - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Off Topic (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=5)
+--- Forum: Programming (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=30)
+--- Thread: onChatted (/showthread.php?tid=6705)

Pages: 1 2


RE: onChatted - Nyht - 07-09-2011

(07-09-2011, 02:27 PM)Jacob_ Wrote: Maybe because you said "fuction" instead of "function"? Tongue

Lol, I fixed that when testing it. I didn't fix it in Notepad++. Tongue
(07-09-2011, 09:45 AM)Duck Wrote: Well for some reason the start of your function is a note

I noted it because that is where the problem is.
(07-09-2011, 02:34 PM)Qwertygiy Wrote: And you don't need a : between link and (.

I also fixed that while testing. Lol.
I am now getting a second error.

Script19: attempted index of non-table: null


[lua]npc = create("NPC")
label = create("Label")

function onChatted(msg)
if msg == "/clone" then
print("Cloning " .. speaker.Name)
npc.Parent = game.World
npc.Name = speaker.Name
label.Parent = npc
label.Text = speaker.Name .. "'s Clone"
npc.Skin = speaker.Character.Skin
print(speaker.Name .. " was successfully cloned.")
else
print(speaker.Name .. "was insuccessfully cloned.")
end
end
--[[ link(Player.Chatted, onChatted) ]]--

print("Loaded Cloning Script")[/lua]


I changed line 4 to line 19 and commented out line 17, and it actually printed that it was loaded.