generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: MED+ Scripters Only: Broken Chat Script

Previous Thread :: Next Thread 
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 05:29 PM
--[[
I'm trying to make it for an AI, and its basically like the Anti ODer script in the free models only I took out the Words table and put it as StringValues in a model, well, I don't know where the error is but it is not working.

Its suppose to get all the stringvalues when somebody says something that is in the model it states of, and if the message is one of those StringValue's names then it will respond.

The respond function works, its something related to when it is suppose to get the children.
]]--

function getmystuff()
endhi = script.Parent:FindFirstChild("AIWords")
hi:GetChildren()
for i= 1, #hi do
if hi[i].className == "StringValue" then
Words = {hi[i]}
end
end
end

function respond()
getmystuff()
aa = hi:FindFirstChild(Word)
chatbox = script.Parent.Head:FindFirstChild("Text")
chatbox.Frame.TextButton.Text = aa.Value
chatbox.Enabled = true
wait(5)
chatbox.Enabled = false
end

function Chatted(Msg, Speaker)
getmystuff()
for AllWords, Word in pairs(Words) do
if string.find(Msg, string.lower(Word)) then
respond()
end
end
end

game.Players.ChildAdded:connect(function(Child)
if Child.className == "Player" then
Child.Chatted:connect(function(Msg)Chatted(Msg, Child)end)
end
end)
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 05:33 PM
Yes I used a free model to make this, I added to it.

bump
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 06:03 PM
Really? 19 views, and not a single reply?

bump.
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 06:48 PM
SH you're being a pain.

Bump
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 07:50 PM
bump
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 07:53 PM
add this to the top:

Words={};

then when you find the StringValue do this:

table['insert'](Words,h[i]['Value]);
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
17 Jan 2014 07:53 PM
*

table['insert'](Words,h[i]['Value']);
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 07:56 PM
--Is this correct?

Words={};

function getmystuff()
endhi = script.Parent:FindFirstChild("AIWords")
hi:GetChildren()
for i= 1, #hi do
if hi[i].className == "StringValue" then
table['insert'](Words,h[i]['Value']);
end
end
end

function respond()
getmystuff()
aa = hi:FindFirstChild(Word)
chatbox = script.Parent.Head:FindFirstChild("Text")
chatbox.Frame.TextButton.Text = aa.Value
chatbox.Enabled = true
wait(5)
chatbox.Enabled = false
end

function Chatted(Msg, Speaker)
getmystuff()
for AllWords, Word in pairs(Words) do
if string.find(Msg, string.lower(Word)) then
respond()
end
end
end

game.Players.ChildAdded:connect(function(Child)
if Child.className == "Player" then
Child.Chatted:connect(function(Msg)Chatted(Msg, Child)end)
end
end)
Report Abuse
Sunsshines is not online. Sunsshines
Joined: 16 Sep 2012
Total Posts: 8395
17 Jan 2014 08:00 PM
Not every script in the entire model breaks now but it still doesn't work.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image