Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
onChatted
#1
I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


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

print("Loaded Cloning Script")

--[[ 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)[/lua]
All my mods are available here.
Reply
#2
(07-09-2011, 06:23 AM)Nyht Wrote: I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


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

print("Loaded Cloning Script")

--[[ fuction 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
linkSadPlayer.Chatted, onChatted)
print(speaker.Name .. " was successfully cloned.")[/lua]


:crazy: Did you do all that?
Reply
#3
(07-09-2011, 08:14 AM)Nice Wrote:
(07-09-2011, 06:23 AM)Nyht Wrote: I've made a script using the onChatted function, however, the output says:

Script6: '=' expected near 'onChatted'.

So I decided to (yet again) turn to this community. I'll convert it to ROBLOX and test it there, even though it will have different methods.


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

print("Loaded Cloning Script")

--[[ fuction 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
linkSadPlayer.Chatted, onChatted)[/lua]


:crazy: Did you do all that?

It is quite simple for an intermediate coder.

I fixed the double of line 14.
All my mods are available here.
Reply
#4
Well for some reason the start of your function is a note
Reply
#5
Maybe because you said "fuction" instead of "function"? Tongue
Reply
#6
"Maybe because you said "fuction" instead of "function"? Tongue"

I laugh at myself when I get typos like this one.
Reply
#7
I still forget semicolons when writing PHP... and it was the first language I learned. [Image: facepalm.gif]
Reply
#8
And you don't need a : between link and (.


Yeah, I'm constantly getting typos in my scripts. Stuff like part.Trasparency or game.Payers:getChildren.
(07-09-2011, 02:34 PM)Jacob_ Wrote: I still forget semicolons when writing PHP... and it was the first language I learned. [Image: facepalm.gif]

I've only started PHP two days ago. Long live w3schools and their massive database!
Reply
#9
"game.Payers:getChildren"

You can't pay using children, that's illegal...
Reply
#10
I honestly cannot believe how I managed to script for months on ROBLOX without knowing about Output. Seriously. Because I make so many little mistakes -- especially now that I know two versions of Lua and I keep trying to subconsciously intertwine them -- that I can't make a 50 line script without one typo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)