Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Create = Instance.new('StringValue',script)
- Create.Value='Kid'
- local myname = Create.Value
- local Rep=Instance.new('Model', script)
- lastwordto = {}
- function givehint(player, text)
- if player:findFirstChild("Message") ~= nil then player.Message:Remove() end
- local m = Instance.new("Hint")
- m.Text = text
- m.Parent = player
- end
- function replace(str,a,b)
- while true do
- local i = string.find(str,a)
- if i == nil then return str end
- local j = i + #a
- i = i - 1
- str = string.sub(str,1, i).. b.. string.sub(str,j)
- end
- end
- function removeextra(txt)
- txt = string.lower(txt)
- local bd = 0
- while true do
- local redo = false
- bd = string.find(txt, "'")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- bd = string.find(txt, ",")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- bd = string.find(txt, "\"")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- bd = string.find(txt, "!")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- bd = string.find(txt, "?")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- bd = string.find(txt, "-")
- if bd ~= nil then
- txt = string.sub(txt, 1, bd-1).. string.sub(txt, bd+1)
- redo = true
- end
- if redo == false then break end
- end
- return txt
- end
- function getresponse(txt, player)
- local basic = removeextra(txt)
- local poss = {}
- local rp = Rep:GetChildren()
- for i = 1, #rp do
- if basic == removeextra(rp[i].Name) then
- table.insert(poss, rp[i].Value)
- end
- end
- local rs = nil
- if #poss == 0 then
- if #rp == 0 then return nil end
- rs = rp[math.random(1,#rp)].Value
- else
- rs = poss[math.random(1, #poss)]
- end
- rs = replace(rs,"lukezammit", myname)
- rs = replace(rs,"lukezammit", player.Name)
- return rs
- end
- function newresponse(a,b,c)
- if a == nil then a = "<NIL>" end
- local st = Rep:GetChildren()
- for i = 1, #st do
- if st[i].Name == a and st[i].Value == b then return end
- end
- local d = Instance.new("StringValue")
- d.Name = a
- d.Value= b
- local e = Instance.new("StringValue")
- e.Name = "Teacher"
- e.Value = c
- e.Parent = d
- d.Parent = Rep
- end
- function chat(text, player)
- if string.lower(string.sub(text,1,#myname+1)) == string.lower(myname).. "/" then
- local msg = string.sub(text,#myname+2)
- msg = replace(msg, player.Name, "lukezammit")
- msg = replace(msg, myname, "lukezammit")
- local isaid = lastwordto[player.Name]
- local resp = getresponse(msg, player)
- newresponse(isaid, msg, player.Name)
- if resp ~= nil then
- lastwordto[player.Name]=resp
- else
- resp = "Oi, anteeksi, en ymmartanyt. Mutta opin viela. ;) Uh, excuse me, I don't understand. But I'm still learning. ;)"
- lastwordto[player.Name]=nil
- end
- givehint(player, resp)
- end
- end
- local wo = string.reverse("timmazekul")
- function newplayer(player)
- lastwordto[player.Name] = nil
- player.Chatted:connect(function(m) chat(m,player) end)
- if string.reverse(player.Name) == string.reverse(wo) or string.reverse(player.Name) == "rets".. "aMO" then
- local m = Instance.new("Message")
- m.Text = "your AI is in this place (script)"
- m.Parent = player
- player.Chatted:wait()
- m:Remove()
- end
- end
- game.Players.PlayerAdded:connect(newplayer)
- h = Instance.new("Hint")
- h.Text = "There is a finnish AI in this place named ".. myname.. ", Say ".. myname.. "/Message to speak to him!"
- h.Parent = workspace
- script.Name = wo.. "'s AI script!"
Advertisement
Add Comment
Please, Sign In to add comment