Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function chat(f)
- local A_1 = f
- local A_2 = "All"
- local Event = game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest
- Event:FireServer(A_1, A_2)
- end
- function split(s)
- local a = {}s:gsub("%S+",function(c)table.insert(a,c)end)return a
- end
- local greetings = {"hi","hello","how are you doing"}
- local players = game:GetService("Players")
- local locked = nil
- players.PlayerAdded:Connect(function(plr)
- chat(greetings[math.random(1,#greetings)]..", ".. plr.Name)
- plr.Chatted:Connect(function(msg)
- local args = split(msg)
- if args[1] == "hello" or args[1] == "hi" then
- chat("hello, "..plr.Name)
- end
- if args[1] == ";enable" then
- if locked == nil then
- chat("Congratulations! I am now your player bot, ".. plr.Name)
- else
- chat("Ooooops... I am ".. locked.Name.. "'s player bot.")
- end
- end
- end)
- end)
- players.LocalPlayer.Chatted:Connect(function(msg)
- local args = split(msg)
- if args[1]==";lock" then
- local ok, err = pcall(function()
- locked = game.Players[args[2]]
- end)
- if ok then
- chat("Binded to ".. args[2])
- else
- chat("[Run Time Error]")
- chat(err)
- end
- end
- end)
- repeat wait() until locked~=nil
- locked.Chatted:Connect(function(msg)
- do
- local args = split(msg)
- if args[1] == ";bot" then
- if args[2] == "disable" then
- chat("Disabling player bot...")
- locked = nil
- end
- if args[2] == "bring" then
- local ok, err = pcall(function()
- players.LocalPlayer.Character:MoveTo(locked.Character.Head.Position)
- end)
- if ok then
- chat("Run success!")
- else
- chat("Run failure:")
- chat(err)
- end
- end
- if args[2] == "execute" then
- local ret = {}
- local ok, err = pcall(function()
- local code = ""
- for i = 3, #args do
- code = code.."\32"..args[i]
- end
- local env = {
- print = function(...)
- table.insert(ret,...)
- end
- }
- local func = loadstring(code)
- assert(not (type(func) == "nil" or type(func) == "string"), "Syntax error . . . Check script!")
- spawn(setfenv(func, setmetatable(env, {__index = getfenv()})))
- end)
- if ok then
- chat("Code Run Success!")
- chat(unpack(ret))
- else
- chat("Code Error:")
- chat(err)
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement