|
| 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 |
|
|
|
| 17 Jan 2014 05:33 PM |
Yes I used a free model to make this, I added to it.
bump |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 06:03 PM |
Really? 19 views, and not a single reply?
bump. |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2014 06:48 PM |
SH you're being a pain.
Bump |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 17 Jan 2014 07:53 PM |
*
table['insert'](Words,h[i]['Value']); |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 17 Jan 2014 08:00 PM |
| Not every script in the entire model breaks now but it still doesn't work. |
|
|
| Report Abuse |
|
|