Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[bots]]
- --[[todo:
- general bug fixes:
- websocket not closing / disconnecting (1/2 fixed, just changed order)
- players with numbers actually get called when typing a player ("123" should get 123player but it used to be nil, not anymore)
- add:
- animate (works)
- cemote custom emote (choose from a list)
- march / marchto (follow but with extra steps)
- cloneanimation (1/2 works)
- snake
- mech (its done, just not added)
- cmds:
- line, to, goto
- cmere
- e, emote, dance
- return
- setting, setsetting
- lookat
- skiddie
- credits, owner
- firework, antiair, aa
- explode, boom
- version
- identifysystem, name
- antiafk, antiidle
- close
- reset
- walkto, follow, chase (un)
- bng (un)
- orbit (un)
- spin (un)
- spook, crazy, scare (un)
- sit (un)
- run, ls, loadstring
- chat
- cinfo, cmdinfo, commandinfo
- stats
- speakorder, order
- setfpscap, fpscap
- circle
- bot (.bot # cmd args)
- stack, hat (un)
- ]]
- local owner = 'XxAsherBlockxX'--thedenteda
- local port = 8081 --8080
- local leaders = {
- 'thedenteda',
- 'ThatSillyGuyFromEat',
- 'Stoomie',
- 'RampageCeremony',
- 'Mrgesmask',
- 'napalm_416',
- 'September6plus5',
- '394_9',
- 'pg_gamer909',
- 'XxAsherBlockxX',
- -- ''
- }
- local bots = {
- 'thedentedb',
- 'thedentedc',
- 'thedentedd',
- 'thedentede',
- 'thedentedf',
- 'thedentedg',
- 'dudeman123qwe123',
- }
- local prefix = '.'
- local lineOffset = 0
- local TCS = game:GetService("TextChatService")
- local TS = game:GetService('TweenService')
- local plrs = game:GetService('Players')
- local lp = plrs.LocalPlayer
- local isLegacyChat = TCS.ChatVersion == Enum.ChatVersion.LegacyChatService
- local COBRA_Active = true
- local letters = {
- ['a'] = 1,
- ['b'] = 2,
- ['c'] = 3,
- ['d'] = 4,
- ['e'] = 5,
- ['f'] = 6,
- ['g'] = 7,
- ['h'] = 8,
- ['i'] = 9,
- ['j'] = 10,
- ['k'] = 11,
- ['l'] = 12,
- ['m'] = 13,
- ['n'] = 14,
- ['o'] = 15,
- ['p'] = 16,
- ['q'] = 17,
- ['r'] = 18,
- ['s'] = 19,
- ['t'] = 20,
- ['u'] = 21,
- ['v'] = 22,
- ['w'] = 23,
- ['x'] = 24,
- ['y'] = 25,
- ['z'] = 26,
- }
- local cversion = 'v.1.84'
- local queueteleport = (syn and syn.queue_on_teleport) or queue_on_teleport or (fluxus and fluxus.queue_on_teleport)
- local canprint = identifyexecutor() == 'Wave'
- if canprint then
- rconsoleclear()
- wait(.1)
- end
- local s,e = pcall(function()
- local reset = true
- if getgenv().botsystem and getgenv().botsystem.reset == false then
- for i, v in getgenv().botsystem.connections do
- pcall(function() v:Disconnect() end)
- end
- for i, v in getgenv().botsystem.todestroy do
- pcall(function() v:Destroy() end)
- end
- getgenv().botsystem.current += 1
- if getgenv().botsystem.newscriptloaded then
- getgenv().botsystem.newscriptloaded:Fire()
- else
- getgenv().botsystem.newscriptloaded = Instance.new('BindableEvent',game:GetService('PolicyService'))
- end
- pcall(function()
- getgenv().botsystem.websocket:Close()
- end)
- reset = false
- end
- if getgenv().botsystem and getgenv().botsystem.version ~= cversion then reset = true end
- if reset == true then
- local antiidle = false
- if getgenv().botsystem and getgenv().botsystem.antiidle ~= nil then
- antiidle = getgenv().botsystem.antiidle
- end
- getgenv().botsystem = {
- ['connections'] = {},
- ['todestroy'] = {},
- ['current'] = 1,
- ['version'] = cversion,
- ['name'] = 'COBRA',
- ['longname'] = 'Collective Operational Bot Resource Architecture',
- ['newscriptloaded'] = nil,
- ['websocket'] = nil,
- ['chatsystem'] = {},
- ['reset'] = false,
- ['antiidle'] = antiidle,
- }
- if getgenv().botsystem.newscriptloaded then
- getgenv().botsystem.newscriptloaded:Fire()
- else
- getgenv().botsystem.newscriptloaded = Instance.new('BindableEvent',game:GetService('PolicyService'))
- end
- if getgenv().botsystem.chatsystem == nil or #getgenv().botsystem.chatsystem == 0 then
- getgenv().botsystem.chatsystem['agree'] = Instance.new('BindableEvent',game:GetService('PolicyService'))
- getgenv().botsystem.chatsystem['disagree'] = Instance.new('BindableEvent',game:GetService('PolicyService'))
- end
- end
- end)
- local commands = {}
- local stack = {}
- local function chatMessage(str)
- str = tostring(str)
- table.insert(stack, str)
- repeat
- task.wait()
- until stack[1] == str
- if not isLegacyChat then
- TCS.TextChannels.RBXGeneral:SendAsync(str)
- else
- game:GetService('ReplicatedStorage').DefaultChatSystemChatEvents.SayMessageRequest:FireServer(str, "All")
- end
- task.wait(.5)
- table.remove(stack, 1)
- end
- if getgenv().botsystem == nil or s == false then
- chatMessage('COBRA BOOT FAILURE!')
- error(e)
- end
- local cinfo = {}
- for i,v in getgenv().botsystem do
- cinfo[i] = v
- end
- local justRestricted = {
- [1] = false,
- [2] = 0,
- }
- local function isOwner(plr)
- local v = plr.Name == owner
- if justRestricted[1] and tick() - justRestricted[2] < 10 then
- if not v then
- justRestricted[1] = true
- justRestricted[2] = tick()
- end
- return v
- end
- if not v then
- justRestricted[1] = true
- justRestricted[2] = tick()
- chatMessage('COBRA // Access denied.')
- end
- return v
- end
- local function hasWS()
- return getgenv().botsystem.websocket ~= nil
- end
- function getRoot(char)
- local rootPart = char:FindFirstChild('HumanoidRootPart') or char:FindFirstChild('Torso') or char:FindFirstChild('UpperTorso')
- return rootPart
- end
- local function getCommand(name)
- if name:gsub(' ', '') == '' then return false end
- if name:gsub(' ', ''):sub(1,1) == '.' then return false end
- for i, v in commands do
- if table.find(v.names, name) then
- return v
- end
- end
- end
- local function runCommand(from, name, args, extra)
- local cmd = getCommand(name)
- if cmd then
- cmd['function'](from, args, extra)
- elseif cmd ~= false then
- chatMessage('No command found.')
- end
- end
- local function r15(plr)
- if plr.Character:FindFirstChildOfClass('Humanoid').RigType == Enum.HumanoidRigType.R15 then
- return true
- end
- end
- if not s then
- chatMessage('Setup error detected. Check logs.')
- warn(e)
- error('Setup error!')
- end
- local funcs = {}
- function funcs.get(prop,info,where,all)
- info = tostring(info)
- if not all then
- for i,v in where:GetChildren() do
- if tostring(v[prop]):lower():sub(1,info:len()) == info:lower() then
- return v
- end
- end
- else
- for i,v in where:GetDescendants() do
- if tostring(v[prop]):lower():sub(1,info:len()) == info:lower() then
- return v
- end
- end
- end
- end
- function funcs.getPlayer(nameOrId)
- local isId = false
- -- if tonumber(nameOrId) ~= nil then
- -- isId = true
- -- end
- if not isId then
- return funcs.get('Name',tostring(nameOrId),game.Players,false) or funcs.get('DisplayName',tostring(nameOrId),game.Players,false)
- else
- local out = funcs.get('UserId',tonumber(nameOrId),game.Players,false)
- if out == nil then
- out = funcs.get('Name',tostring(nameOrId),game.Players,false) or funcs.get('DisplayName',tostring(nameOrId),game.Players,false)
- end
- return out
- end
- end
- local function playerMetric(whoRan,input)
- local input = input:lower()
- if whoRan then
- if input == 'me' then return {whoRan} end
- if input == 'others' then
- local d = game.Players:GetPlayers()
- for i,v in d do
- if v == whoRan then
- table.remove(d,i)
- end
- end
- return d
- end
- end
- if input == 'all' then return game.Players:GetPlayers() end
- if input == 'random' then
- local a = plrs:GetPlayers()
- for i,v in a do
- if table.find(bots,v.Name) or table.find(leaders,v.Name) then
- table.remove(a,i)
- end
- end
- local b = #a return {a[math.random(1,b)]}
- end
- end
- function funcs.getPlayerUsingMetrics(whoRan,input)
- if type(input) == 'table' then
- local list = {}
- for i,v in input do
- local isMetric = playerMetric(whoRan,v)
- if isMetric then
- table.insert(list, isMetric)
- else
- local isPlr = funcs.getPlayer(v)
- if isPlr then
- table.insert(list, funcs.getPlayer(v))
- end
- end
- end
- local pm = startCleanForDupes(list)
- if pm then
- return pm
- else
- local list = {}
- for i,v in input do
- table.insert(list, funcs.getPlayer(v))
- end
- return startCleanForDupes(list) or nil
- end
- elseif type(input) == 'string' then
- local pm = playerMetric(whoRan,input)
- if pm then
- return pm
- else
- return {funcs.getPlayer(input)} or nil
- end
- end
- end
- local function getOnlineBots()
- local activeBots = {}
- for _, bot in ipairs(bots) do
- for _, player in ipairs(plrs:GetPlayers()) do
- if player.Name == bot then
- table.insert(activeBots, bot)
- end
- end
- end
- return activeBots
- end
- local function getOrder(name)
- if name == nil then warn('ORDER // No name given. :: Used LocalPlayer.') name = lp.Name end
- if table.find(bots, name) then
- local activeBots = getOnlineBots()
- for i, bot in ipairs(activeBots) do
- if bot == name then
- return i
- end
- end
- end
- if tonumber(name:sub(#name, #name)) then
- return tonumber(name:sub(#name, #name))
- elseif letters[name:sub(#name, #name)] then
- return letters[name:sub(#name, #name)]
- end
- end
- local function numberLister(inp)
- local got = {}
- for part in inp:gmatch("[^,]+") do
- if part:find(":") then
- local range_start, range_end = part:match("(%d+):(%d+)")
- range_start, range_end = tonumber(range_start), tonumber(range_end)
- if range_start and range_end then
- for i = range_start, range_end do
- table.insert(got, i)
- end
- end
- else
- local num = tonumber(part)
- if num then
- table.insert(got, num)
- end
- end
- end
- local unique = {}
- for _, v in ipairs(got) do
- unique[v] = true
- end
- got = {}
- for k in pairs(unique) do
- table.insert(got, k)
- end
- return got
- end
- local function formatErrorMessage(msg)
- return msg:split(':')[#msg:split(':')]
- end
- local function sayError(msg)
- chatMessage(tostring(formatErrorMessage(msg)))
- end
- local function newCommand(names, args, func)
- table.insert(commands, {
- ['names'] = names,
- ['args'] = args,
- ['function'] = func,
- })
- end
- local function isOkay(what)
- chatMessage(`{what} (Y/N)`)
- local y,n
- local isYes = nil
- local timeout = tick()+10
- y = getgenv().botsystem.chatsystem['agree'].Event:Once(function()
- isYes = true
- n:Disconnect()
- end)
- n = getgenv().botsystem.chatsystem['disagree'].Event:Once(function()
- isYes = false
- y:Disconnect()
- end)
- repeat wait() until isYes ~= nil or tick() - timeout > 0
- return isYes
- end
- local function decodeid(input)
- local a=string.byte('e')-1
- input=input:gsub('>','')
- local out = ''
- print(input)
- for i=1,#input do
- local num = input:sub(i,i)
- -- print(num)
- -- print(string.byte(num)-a)
- out=out..(string.byte(num)-a)
- end
- return out
- end
- newCommand({'test'},{},function(speaker, args)
- if isOwner(speaker) then
- chatMessage(`{tostring(speaker)} just tested a command with arg1 being {tostring(args[1])}`)
- end
- end)
- local stackLoop
- newCommand({'hat','stack'},{'player:player'},function(speaker, args)
- if stackLoop and stackLoop.Connected then
- stackLoop:Disconnect()
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- if hum and hum.Health > 0 then
- hum.PlatformStand = false
- end
- end
- local players = funcs.getPlayerUsingMetrics(speaker,(args[1] == nil or args[1] == '') and 'me' or args[1])
- local v = players[1]
- if not v then return end
- local char = v.Character
- local order = getOrder(lp.Name) or 1 + lineOffset
- stackLoop = game:GetService('RunService').Stepped:Connect(function(_,delta)
- local root = lp.Character.HumanoidRootPart
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- root.AssemblyLinearVelocity = Vector3.new(0,2.1,0)
- if v.Character and v.Character:FindFirstChild('HumanoidRootPart') and v.Character:FindFirstChildWhichIsA('Humanoid') and v.Character:FindFirstChildWhichIsA('Humanoid').Health > 0 then
- local thead = v.Character:FindFirstChild('Head')
- if thead then
- root.CFrame = thead.CFrame*CFrame.new(0,-1.4+order*4.9,0)
- if hum and hum.Health > 0 then
- hum.PlatformStand = true
- else
- stackLoop:Disconnect()
- end
- end
- else
- stackLoop:Disconnect()
- end
- end)
- table.insert(getgenv().botsystem.connections,stackLoop)
- end)
- newCommand({'unhat','unstack'},{'player:player'},function(speaker, args)
- if stackLoop and stackLoop.Connected then
- stackLoop:Disconnect()
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- if hum and hum.Health > 0 then
- hum.PlatformStand = false
- end
- end
- end)
- newCommand({'runanim','anim','runanimation','animate'},{'id:number|string'},function(speaker, args)
- if args[1] == nil then return end
- local looped = args[2] == 'true' and true or false
- local id = tonumber(args[1])
- if not id then
- warn(args[1])
- id = decodeid(args[1])
- end
- local hum = lp.Character.Humanoid
- -- for i,v in pairs(hum.Animator:GetPlayingAnimationTracks()) do
- -- v:Stop()
- -- end
- local ani = Instance.new("Animation")
- ani.AnimationId = 'rbxassetid://'..id
- local track = hum.Animator:LoadAnimation(ani)
- if args[2] ~= nil then
- track.Looped = looped
- end
- track:Play()
- end)
- newCommand({'stopanimation','stopanim','stopanimations','haltanim','haltanims','resetanim','resetanims'},{},function(speaker, args)
- local char = lp.Character
- local hum = char:FindFirstChildOfClass("Humanoid") or char:FindFirstChildOfClass("AnimationController")
- for i,v in next, hum:GetPlayingAnimationTracks() do
- v:Stop()
- end
- wait()
- -- if char:FindFirstChild('Animate') and char:FindFirstChild('Animate'):FindFirstChild('idle') then
- -- local val = char:FindFirstChild('Animate') and char:FindFirstChild('Animate'):FindFirstChild('idle')
- -- local ani = val:FindFirstChild('Animation1')
- -- if ani then
- -- local track = hum.Animator:LoadAnimation(ani)
- -- track:Play()
- -- end
- -- end
- if char:FindFirstChild('Animate') then
- char:FindFirstChild('Animate').Enabled = false
- task.wait()
- char:FindFirstChild('Animate').Enabled = true
- end
- end)
- newCommand({'copyanim'},{'player:player'},function(speaker, args)
- local players = funcs.getPlayerUsingMetrics(speaker,args[1])
- local v = players[1]
- if not v then return end
- local char = v.Character
- for _, v1 in pairs(lp.Character:FindFirstChildOfClass('Humanoid'):GetPlayingAnimationTracks()) do
- v1:Stop()
- end
- for _, v1 in pairs(v.Character:FindFirstChildOfClass('Humanoid'):GetPlayingAnimationTracks()) do
- if not string.find(v1.Animation.AnimationId, "507768375") then
- local ANIM = lp.Character:FindFirstChildOfClass('Humanoid'):LoadAnimation(v1.Animation)
- ANIM:Play(.1, 1, v1.Speed)
- ANIM.TimePosition = v1.TimePosition
- ANIM.Looped=v1.Looped
- task.spawn(function()
- v1.Stopped:Wait()
- ANIM:Stop()
- ANIM:Destroy()
- end)
- end
- end
- end)
- newCommand({'disconnect','disconnectconnections','removeconnections'},{},function(speaker, args)
- if isOwner(speaker) then
- if isOkay('This may break things, and shouldn\'t be used. Are you sure?') then
- chatMessage('Disconnecting and destroying connections...')
- for i, v in getgenv().botsystem.connections do
- pcall(function() v:Disconnect() end)
- end
- for i, v in getgenv().botsystem.todestroy do
- pcall(function() v:Destroy() end)
- end
- end
- end
- end)
- newCommand({'rendering','setrendering'},{'on / off:bool'},function(speaker, args)
- if isOwner(speaker) then
- local tru = {
- 'true',
- 'enable',
- }
- local fals = {
- 'false',
- 'disable',
- }
- if args[1] == nil then
- chatMessage(`COBRA Warning // Invalid argument for #1.`)
- else
- if table.find(tru,args[1]) then
- game:GetService('RunService'):Set3dRenderingEnabled(true)
- elseif table.find(fals,args[1]) then
- game:GetService('RunService'):Set3dRenderingEnabled(false)
- end
- end
- end
- end)
- newCommand({'setfpscap','fpscap'},{},function(speaker, args)
- if isOwner(speaker) then
- local n = tonumber(args[1])
- if n then
- local out = math.clamp(n,30,90)
- setfpscap(out)
- if n~=out then
- chatMessage(`COBRA Warning // Fps is clamped to ensure stability! // Set to {out}.`)
- end
- else
- setfpscap(60)
- end
- end
- end)
- newCommand({'speakorder','order'},{},function(speaker, args)
- if isOwner(speaker) then
- local d = getOrder(lp.Name) or 1
- for i=1,d do task.wait() task.wait() end
- chatMessage(tostring(d))
- end
- end)
- newCommand({'stats'},{},function(speaker, args)
- local statsService = game:GetService("Stats")
- local startTime = os.clock()
- local frameCount = 0
- local connection
- connection = game:GetService("RunService").RenderStepped:Connect(function()
- frameCount += 1
- end)
- task.wait(.25)
- connection:Disconnect()
- local fps = frameCount*4
- local networkStats = statsService.Network.ServerStatsItem["Data Ping"]
- local ping = networkStats and math.ceil(networkStats:GetValue()) or "Unavailable"
- local userSettings = UserSettings():GetService("UserGameSettings")
- local graphicsQuality = tonumber(userSettings.SavedQualityLevel.Name:sub(#'QualityLevel' + 1))
- chatMessage(string.format("FPS: %d // Ping: %s ms", fps, ping))
- end)
- -- local function getlevels()
- -- local userSettings = UserSettings():GetService("UserGameSettings")
- -- local qualityLevel = tonumber(userSettings.SavedQualityLevel.Name:sub(#'QualityLevel' + 1))
- -- local volumeLevel = math.floor(userSettings.MasterVolume * 10)
- -- local levels = {
- -- ['graphics'] = qualityLevel,
- -- ['volume'] = volumeLevel,
- -- }
- -- return levels
- -- end
- newCommand({'setting','setsetting'},{'setting','value'},function(speaker, args)
- if isOwner(speaker) then
- -- local settingz = {
- -- ['graphics'] = 15,
- -- ['volume'] = 11,
- -- }
- -- if args[1] and settingz[args[1]] then else return chatMessage('No setting found.') end
- if args[2] and tonumber(args[2]) then else return chatMessage('Value is not a number.') end
- UserSettings():GetService("UserGameSettings").MasterVolume = 0
- -- local esc = Enum.KeyCode.Escape
- -- local tab = Enum.KeyCode.Tab
- -- local down = Enum.KeyCode.Down
- -- local left = Enum.KeyCode.Left
- -- local right = Enum.KeyCode.Right
- -- local target = args[2]
- -- local toEdit = args[1]
- -- target = math.clamp(target, 0, 10)
- -- local levels = getlevels()
- -- local level = levels[toEdit] or 0
- -- local vim = game:GetService("VirtualInputManager")
- -- local function press(key)
- -- vim:SendKeyEvent(true, key, false, game)
- -- task.wait(0.05)
- -- vim:SendKeyEvent(false, key, false, game)
- -- end
- -- if game:GetService("GuiService").MenuIsOpen then
- -- while game:GetService("GuiService").MenuIsOpen do
- -- press(esc)
- -- task.wait(0.5)
- -- end
- -- end
- -- press(esc)
- -- task.wait(0.05)
- -- press(tab)
- -- task.wait(0.1)
- -- for _ = 1, settingz[toEdit] do
- -- task.wait()
- -- press(down)
- -- end
- -- local adjustment = target - level
- -- local keyToPress = adjustment > 0 and right or left
- -- for _ = 1, math.abs(adjustment) do
- -- task.wait()
- -- press(keyToPress)
- -- end
- -- press(esc)
- -- if toEdit == 'graphics' then
- -- target = math.clamp(target,1,10)
- -- end
- -- local levels = getlevels()
- -- if levels[toEdit] == target then
- -- chatMessage(`Successfully set {toEdit} to {target}`)
- -- else
- -- chatMessage('COBRA Warning // Failed to set settings! // Something might be messed up.')
- -- end
- end
- end)
- newCommand({'rejoin','rj'},{},function(speaker, args)
- if isOwner(speaker) then
- chatMessage(`COBRA Rejoin // Rejoining induces instability. // Some account(s) may not join back!`)
- chatMessage(`COBRA Rejoin // This is a development system! // Relaunch required!`)
- wait(1)
- if queueteleport then
- local on = [[]]
- queueteleport(on)
- end
- wait(.1)
- lp:Kick("\nRejoining...")
- wait()
- game:GetService('TeleportService'):Teleport(game.PlaceId, lp)
- end
- end)
- local watchlooped = false
- newCommand({'lookat','watch'},{'player:player','speed:number|bool'},function(speaker, args)
- if watchlooped then watchlooped = false wait(.5) end
- local players = funcs.getPlayerUsingMetrics(speaker,args[1])
- local target = players[1]
- if target then
- local root = target.Character.PrimaryPart
- local lroot = lp.Character.HumanoidRootPart
- if root and lroot then
- local speed = 0
- watchlooped = false
- if args[2] and tonumber(args[2]) then
- speed = math.clamp( tonumber(args[2]), 0, 5)
- elseif args[2] == 'true' then
- watchlooped = true
- end
- repeat
- local targetPosition = root.Position
- local playerPosition = lroot.Position
- local direction = Vector3.new(targetPosition.X - playerPosition.X, 0, targetPosition.Z - playerPosition.Z).Unit
- local epos = CFrame.new(playerPosition, playerPosition + direction)
- TS:Create(lroot, TweenInfo.new(speed), {CFrame = epos}):Play()
- wait()
- until not watchlooped
- else
- chatMessage('Root part not found.')
- end
- else
- chatMessage('No player found.')
- end
- end)
- newCommand({'unlookat','unwatch'},{},function(speaker, args)
- watchlooped = false
- end)
- newCommand({'skiddie'},{},function(speaker, args)
- if isOwner(speaker) then
- chatMessage(`This is NOT a script you can have, take, or find.`)
- chatMessage(`You cannot buy this or have it be sent to you in any way.`)
- end
- end)
- newCommand({'credits','owner'},{},function(speaker, args)
- chatMessage(`COBRA Credits // Script made by thedenteda // {getgenv().botsystem.version}`)
- end)
- newCommand({'dance','emote','e'},{'emote name:string'},function(speaker, args)
- if args[1] == 'stop' then lp.Character.Humanoid.Sit = true task.wait(.01) lp.Character.Humanoid.Sit = false return end
- local ani =lp.Character:FindFirstChild('Animate')
- if ani and ani:FindFirstChild('PlayEmote') then
- local res = ani:FindFirstChild('PlayEmote'):Invoke(tostring(args[1]))
- if not res then
- chatMessage('Couldn\'t play that emote.')
- end
- end
- end)
- newCommand({'firework','antiair','aa'},{},function(speaker, args)
- local char = lp.Character
- local pp = char.HumanoidRootPart
- TS:Create(pp, TweenInfo.new(.5),{AssemblyLinearVelocity = Vector3.new(0,250,0)}):Play()
- wait(.6)
- TS:Create(pp, TweenInfo.new(.25),{AssemblyAngularVelocity = Vector3.new(0,300,0)}):Play()
- wait(.3)
- char:FindFirstChildWhichIsA('Humanoid').Health = 0
- end)
- local wondering = false
- newCommand({'wonder','aimlesslywalk','findfather'},{},function(speaker, args)
- wondering = true
- task.spawn(function()
- while wondering and wait(math.random(1,3)) do
- if lp.Character and
- lp.Character:FindFirstChild("Humanoid") and
- lp.Character:FindFirstChild("HumanoidRootPart") then
- local currentPos = lp.Character.HumanoidRootPart.Position
- local randomOffset = Vector3.new(
- math.random(-20, 20),
- 0,
- math.random(-20, 20)
- )
- local targetPos = currentPos + randomOffset
- lp.Character.Humanoid:MoveTo(targetPos)
- end
- end
- end)
- end)
- newCommand({'unwonder','unaimlesslywalk','unfindfather','nofather'},{},function(speaker, args)
- wondering = false
- end)
- newCommand({'explode','boom'},{'size (optional):number'},function(speaker, args)
- local char = lp.Character
- local pp = char.HumanoidRootPart
- local size = tonumber(args[1]) and tonumber(args[1])*100 or 10*100
- TS:Create(pp, TweenInfo.new(.25),{AssemblyAngularVelocity = Vector3.new(0,size,0)}):Play()
- wait(.3)
- char:FindFirstChildWhichIsA('Humanoid').Health = 0
- end)
- newCommand({'version'},{},function(speaker, args)
- chatMessage(`COBRA Version // {tostring(cinfo.version)}`)
- end)
- newCommand({'identifysystem','name'},{},function(speaker, args)
- chatMessage(`{tostring(cinfo.name)} // {tostring(cinfo.longname)}`)
- end)
- local antiafk
- newCommand({'antiafk','antiidle'},{'set to <true, false> or status (optional)', '(if arg1 = true) should disconnect anyway?:bool'},function(speaker, args)
- if args[1] == nil or args[1] == '' or args[1] == 'true' then
- if antiafk and antiafk.Connected then
- if args[2] == 'true' then
- antiafk:Disconnect()
- wait()
- else
- chatMessage('Antiafk is already running.')
- return
- end
- end
- local VirtualUser = cloneref(game:GetService("VirtualUser"))
- antiafk = lp.Idled:Connect(function()
- VirtualUser:CaptureController()
- VirtualUser:ClickButton2(Vector2.new())
- end)
- table.insert(getgenv().botsystem.connections,antiafk)
- getgenv().botsystem.antiidle = true
- chatMessage('Antiafk online!')
- elseif args[1] == 'disconnect' or args[1] == 'false' then
- if isOwner(speaker) then
- if table.find(getgenv().botsystem.connections, antiafk) then
- table.remove(getgenv().botsystem.connections,table.find(getgenv().botsystem.connections, antiafk))
- end
- if antiafk and antiafk.Connected then
- antiafk:Disconnect()
- getgenv().botsystem.antiidle = false
- chatMessage('Antiafk disabled.')
- end
- end
- elseif args[1] == 'status' then
- chatMessage(`Anti-Idle status: {tostring(antiafk and antiafk.Connected or false)}`)
- end
- end)
- newCommand({'close','exit'},{},function(speaker, args)
- if isOwner(speaker) then
- local leaving = {
- 'Good bye!',
- 'Bye!',
- 'Cya!',
- 'Adios!',
- 'self = nil',
- '...',
- }
- COBRA_Active = false
- chatMessage(leaving[math.random(1,#leaving)])
- wait(1)
- game:Shutdown()
- end
- end)
- newCommand({'cmere','bring'},{},function(speaker, args)
- local lroot = lp.Character.HumanoidRootPart
- local sroot = speaker.Character.HumanoidRootPart
- lroot.CFrame = sroot.CFrame * CFrame.new(0,0,-3) * CFrame.Angles(0,math.rad(180),0)
- end)
- newCommand({'reset'},{},function(speaker, args)
- local lhum = lp.Character.Humanoid
- lhum.Health = 0
- local targets = funcs.getPlayerUsingMetrics(speaker,args[1])
- if targets and targets[1] then
- local target = targets[1]
- end
- end)
- local walkto
- local function pathTo(path,v,hum)
- path:ComputeAsync(lp.Character.PrimaryPart.Position, v.Character.PrimaryPart.Position)
- local waypoints = path:GetWaypoints()
- local distance
- for waypointIndex, waypoint in pairs(waypoints) do
- local waypointPosition = waypoint.Position
- hum:MoveTo(waypointPosition)
- -- repeat
- -- distance = (waypointPosition - hum.Parent.PrimaryPart.Position).magnitude
- -- wait()
- -- if walkto == false then
- -- return
- -- end
- -- until
- -- distance <= 5
- hum.MoveToFinished:Wait()
- if walkto == false then
- return
- end
- if waypointIndex % 5 == 0 then
- path()
- end
- end
- end
- newCommand({'walkto','follow','chase'},{'player:player'},function(speaker, args)
- walkto = false
- wait(.5)
- local players = funcs.getPlayerUsingMetrics(speaker,args[1] == nil and 'me' or args[1])
- local hum = lp.Character:FindFirstChildOfClass("Humanoid")
- local path = game:GetService('PathfindingService'):CreatePath()
- for i,v in pairs(players)do
- if v.Character ~= nil then
- if lp.Character:FindFirstChildOfClass('Humanoid') and lp.Character:FindFirstChildOfClass('Humanoid').SeatPart then
- lp.Character:FindFirstChildOfClass('Humanoid').Sit = false
- wait(.1)
- end
- walkto = true
- repeat wait()
- local success, response = pcall(function()
- pathTo(path,v,hum)
- end)
- if not success then
- if lp.Character and lp.Character:FindFirstChildOfClass('Humanoid') and lp.Character:FindFirstChildOfClass('Humanoid').Health > 0 then
- lp.Character:FindFirstChildOfClass('Humanoid'):MoveTo(v.Character.PrimaryPart.Position)
- end
- end
- until v.Character == nil or not v.Character or walkto == false
- end
- end
- end)
- newCommand({'unwalkto','unfollow','unchase'},{},function(speaker, args)
- walkto = false
- end)
- local bangLoop
- local bangDied
- newCommand({'bng','bang'},{'player:player','speed:number'},function(speaker, args)
- if bangDied or bangLoop then
- if bangDied then bangDied:Disconnect() end
- bang:Stop()
- bangAnim:Destroy()
- if bangLoop then bangLoop:Disconnect() end
- wait(.5)
- end
- local players = funcs.getPlayerUsingMetrics(speaker,args[1])
- if players and players[1] then
- local v = players[1]
- local humanoid = lp.Character:FindFirstChildWhichIsA("Humanoid")
- bangAnim = Instance.new("Animation")
- bangAnim.AnimationId = "rbxassetid://5918726674"
- bang = humanoid:LoadAnimation(bangAnim)
- bang:Play(0.1, 1, 1)
- bang:AdjustSpeed(args[2] or 3)
- table.insert(getgenv().botsystem.todestroy, bang)
- bangDied = humanoid.Died:Connect(function()
- bang:Stop()
- bangAnim:Destroy()
- bangDied:Disconnect()
- bangLoop:Disconnect()
- end)
- table.insert(getgenv().botsystem.connections,bangDied)
- local bangplr = v.Name
- local bangOffet = CFrame.new(0, 0, 1.1)
- bangLoop = game:GetService('RunService').Stepped:Connect(function()
- pcall(function()
- local otherRoot = v.Character.HumanoidRootPart
- lp.Character.HumanoidRootPart.CFrame = otherRoot.CFrame * bangOffet
- lp.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(0,2.1,0)
- end)
- end)
- table.insert(getgenv().botsystem.connections,bangLoop)
- end
- end)
- newCommand({'unbng','unbang'},{},function(speaker, args)
- if bangDied or bangLoop then
- if bangDied then bangDied:Disconnect() end
- bang:Stop()
- bangAnim:Destroy()
- if bangLoop then bangLoop:Disconnect() end
- end
- end)
- local orbitLoop
- local orbitLoop2
- newCommand({'orbit'},{'player:player','follow rotation:bool','speed:number'},function(speaker, args, spook)
- if orbitLoop2 and orbitLoop2.Connected or orbitLoop and orbitLoop.Connected then
- if spook or isOkay('Another "orbit" detected. Would you like to disconnect it?') then
- chatMessage('Disconnecting and launching...')
- runCommand(speaker, 'unorbit', {})
- wait(.5)
- else
- chatMessage('Launching another "orbit." One second...')
- end
- end
- local players = funcs.getPlayerUsingMetrics(speaker,args[1] and args[1] or 'me')
- if players and players[1] then
- local v = players[1]
- local rot = 0
- local speed = tonumber(args[3]) or 1
- local followCF = args[2] == 'true' and true or args[2] == 'false' and false
- local order = getOrder(lp.Name) or 1 + lineOffset
- orbitLoop = game:GetService('RunService').Stepped:Connect(function(_,delta)
- local root = lp.Character.HumanoidRootPart
- root.AssemblyLinearVelocity = Vector3.new(0,2.1,0)
- root.Anchored = false
- rot += 1 * speed * (delta * 100) * (1 + (order * .1))
- if v.Character and v.Character:FindFirstChild('HumanoidRootPart') and v.Character:FindFirstChildWhichIsA('Humanoid') and v.Character:FindFirstChildWhichIsA('Humanoid').Health > 0 then
- local otherroot = v.Character:FindFirstChild('HumanoidRootPart')
- local mult = 2
- local offset = CFrame.new(0,0,-7.5)
- local target = followCF and otherroot.CFrame or CFrame.new(otherroot.CFrame.Position)
- target *= CFrame.Angles(0,math.rad(rot),0)
- offset *= CFrame.new(0,0,(-order*mult)+(mult))
- root.CFrame = target * offset * CFrame.Angles(0,math.rad(180),0)
- wait()
- root.Anchored = false
- else
- orbitLoop:Disconnect()
- end
- if spook then
- if spook.tosay then
- local shouldSay = math.random(1,750) == 1
- if shouldSay then
- chatMessage(tostring(spook.tosay[math.random(1,#spook.tosay)]))
- end
- end
- end
- end)
- table.insert(getgenv().botsystem.connections,orbitLoop)
- else
- chatMessage('No player(s) found.')
- end
- end)
- newCommand({'orbit2'},{'player:player','distance:number','speed:number'},function(speaker, args, spook)
- if orbitLoop2 and orbitLoop2.Connected or orbitLoop and orbitLoop.Connected then
- if isOkay('Another "orbit" detected. Would you like to disconnect it?') then
- chatMessage('Got it. Disconnecting and launching...')
- runCommand(speaker, 'unorbit', {})
- wait(.5)
- else
- chatMessage('Launching another "orbit." One second...')
- end
- end
- local speed = tonumber(args[3]) or 1
- local rotated = 0
- local players = funcs.getPlayerUsingMetrics(speaker,args[1] and args[1] or 'me')
- if players and players[1] then else return chatMessage('No player(s) found.') end
- print(players[1])
- print(args[1])
- print(args[1] and args[1] or 'me')
- orbitLoop2 = game:GetService('RunService').Stepped:Connect(function(_,delta)
- local online = getOnlineBots()
- local order = getOrder(lp.Name)
- rotated += 1 * speed * (delta * 100)
- local splitBy = 360/#online
- local rot = CFrame.Angles(0,math.rad(splitBy*order + rotated),0)
- local distance = tonumber(args[2]) or 5
- distance = math.clamp(distance,0,99)
- if players and players[1] then
- local v = players[1]
- if v.Character and v.Character:FindFirstChild('HumanoidRootPart') and v.Character:FindFirstChildWhichIsA('Humanoid') and v.Character:FindFirstChildWhichIsA('Humanoid').Health > 0 then
- local rp = getRoot(v.Character)
- local rpp = CFrame.new(rp.Position)
- getRoot(lp.Character).CFrame = rpp*rot*CFrame.new(0,0,-distance)*CFrame.Angles(0,math.rad(180),0)
- lp.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(0,2.1,0)
- else
- orbitLoop2:Disconnect()
- end
- end
- end)
- table.insert(getgenv().botsystem.connections,orbitLoop2)
- end)
- newCommand({'unorbit'},{},function(speaker, args)
- if orbitLoop then
- orbitLoop:Disconnect()
- local root = lp.Character.HumanoidRootPart
- root.Anchored = false
- end
- if orbitLoop2 then
- orbitLoop2:Disconnect()
- local root = lp.Character.HumanoidRootPart
- root.Anchored = false
- end
- end)
- newCommand({'spin'},{'speed:number'},function(speaker, args)
- local spinSpeed = 20
- if args[1] and tonumber(args[1]) then
- spinSpeed = args[1]
- end
- for i,v in pairs(getRoot(lp.Character):GetChildren()) do
- if v.Name == "Spinning" then
- v:Destroy()
- end
- end
- local Spin = Instance.new("BodyAngularVelocity")
- Spin.Name = "Spinning"
- Spin.Parent = getRoot(lp.Character)
- Spin.MaxTorque = Vector3.new(0, math.huge, 0)
- Spin.AngularVelocity = Vector3.new(0,spinSpeed,0)
- end)
- newCommand({'unspin'},{},function(speaker, args)
- for i,v in pairs(lp.Character.HumanoidRootPart:GetChildren()) do
- if v.Name == "Spinning" then
- v:Destroy()
- end
- end
- end)
- newCommand({'circle'},{'player:player','distance:number'},function(speaker, args)
- local online = getOnlineBots()
- local order = getOrder(lp.Name)
- local splitBy = 360/#online
- local rot = CFrame.Angles(0,math.rad(splitBy*order),0)
- local players = funcs.getPlayerUsingMetrics(speaker,args[1] and args[1] or 'me')
- local distance = tonumber(args[2]) or 5
- distance = math.clamp(distance,0,99)
- if players and players[1] then
- local v = players[1]
- local rp = getRoot(v.Character)
- local rpp = CFrame.new(rp.Position)
- getRoot(lp.Character).CFrame = rpp*rot*CFrame.new(0,0,-distance)*CFrame.Angles(0,math.rad(180),0)
- end
- end)
- newCommand({'spook','crazy','scare'},{'player:player'},function(speaker, args)
- -- local nargs = {}
- -- for i,v in args do
- -- if i==1 then continue end
- -- nargs[i] = v
- -- end
- if orbitLoop then
- orbitLoop:Disconnect()
- wait(.5)
- end
- runCommand(speaker, 'orbit', {args[1], 'false', '3'}, {
- ['tosay'] = {
- 'You are losing your mind..',
- 'It\'s in your walls.',
- 'Wake up..',
- 'You NEED to wake up..',
- 'You can\'t hide forever...',
- 'You can\'t run from the truth..',
- 'the end is never the end is never',
- },
- })
- end)
- newCommand({'unspook','uncrazy','unscare'},{},function(speaker, args)
- runCommand(speaker, 'unorbit', args)
- chatMessage('You are safe.. for now.')
- end)
- newCommand({'sit'},{'value:bool'},function(speaker, args)
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- local should = args[1] == 'true' and true or args[1] == 'false' and false
- if args[1] == nil then
- should = true
- end
- hum.Sit = should
- end)
- newCommand({'jump'},{},function(speaker, args)
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- hum.Jump = true
- end)
- newCommand({'hh','hipheight'},{},function(speaker, args)
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- hum.HipHeight = tonumber(args[1]) or (r15(lp) and 2.1 or 0)
- end)
- newCommand({'unsit'},{},function(speaker, args)
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- hum.Sit = false
- end)
- newCommand({'unsit'},{},function(speaker, args)
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- hum.Sit = false
- end)
- newCommand({'to','goto','line'},{'player:player','line type:string'},function(speaker, args)
- local lroot = lp.Character.HumanoidRootPart
- local result = funcs.getPlayerUsingMetrics(speaker,(args[1] == nil or args[1] == '') and 'me' or args[1])
- local order = getOrder(lp.Name) or 1 + lineOffset
- local mult = 3
- local offset = CFrame.new(0,0,-3)
- if args[2] == nil or args[2] == 'vertical' then
- offset *= CFrame.new(0,0,(-order*mult)+(mult))
- elseif args[2] == 'horizontal' then
- mult = 4
- offset *= CFrame.new((-order*mult)+(mult),0,0)
- else
- task.spawn(chatMessage,'Unknown line type; using vertical.')
- offset *= CFrame.new(0,0,(-order*mult)+(mult))
- end
- if result and result[1] then
- local sroot = result[1].Character.HumanoidRootPart
- lroot.CFrame = sroot.CFrame * offset * CFrame.Angles(0,math.rad(180),0)
- else
- chatMessage('No players found.')
- end
- end)
- newCommand({'return'},{'to return:string'},function(speaker, args)
- if isOwner(speaker) then
- local s = [[local loadstring = function() error('Loadstring is disabled.') end
- blocked = function(a) error('Function is locked.') end
- local getgenv,getfenv = blocked,blocked
- local getrenv,getsenv = blocked,blocked
- local writefile,loadfile = blocked,blocked
- local setclipboard,write_clipboard = blocked,blocked
- local rawget = blocked
- --local _G = {}
- local db = {}
- for i,v in pairs(debug) do
- if type(v) == 'function' then
- db[i] = blocked
- else
- db[i] = v
- end
- end
- local debug = db
- db = nil
- ]]
- local e = s..`return {args[1]}`
- local got = loadstring(e)()
- local out = got or 'There\'s no output for that.'
- chatMessage(tostring(out))
- end
- end)
- newCommand({'run','loadstring','ls'},{'code:string'},function(speaker, args)
- if isOwner(speaker) then
- local s = [[local loadstring = function() error('Loadstring is disabled.') end
- blocked = function(a) error('Function is locked.') end
- local getgenv,getfenv = blocked,blocked
- local getrenv,getsenv = blocked,blocked
- local writefile,loadfile = blocked,blocked
- local setclipboard,write_clipboard = blocked,blocked
- local rawget = blocked
- --local _G = {}
- local db = {}
- for i,v in pairs(debug) do
- if type(v) == 'function' then
- db[i] = blocked
- else
- db[i] = v
- end
- end
- local debug = db
- db = nil
- ]]
- local all = ''
- for i,v in args do
- if v ~= nil then
- all = all..' '..tostring(v)
- end
- end
- if all:gsub(' ',''):match('whiletrue') then chatMessage('COBRA Security blocked your string.') return end
- -- if all:match('getfenv') then chatMessage('COBRA Security blocked your string.') return end
- local e = s..all
- local s,err = pcall(function()
- loadstring(e)()
- end)
- if not s then
- warn(err)
- chatMessage(`Code ran into an error; "{tostring(formatErrorMessage(err)):sub(2)}"`)
- elseif err ~= nil then
- chatMessage(`Code outputted: {tostring(err)}`)
- end
- end
- end)
- newCommand({'chat','say'},{'message:string'},function(speaker, args)
- if isOwner(speaker) then
- local all = ''
- for i,v in args do
- if v ~= nil then
- all = all..' '..tostring(v)
- end
- end
- chatMessage(tostring(all))
- end
- end)
- newCommand({'clearchat'},{},function(speaker, args)
- if TCS.ChatVersion == Enum.ChatVersion.TextChatService then
- TCS.TextChannels.RBXGeneral:SendAsync("?"..string.rep('\r',180).."-- Cleared Chat --")
- end
- end)
- newCommand({'announce'},{'message:string'},function(speaker, args)
- if args[1] == nil then
- args[1] = ''
- end
- args[1] = 'THIS IS NOT A DRILL:\r'..args[1]
- if TCS.ChatVersion == Enum.ChatVersion.TextChatService then
- TCS.TextChannels.RBXGeneral:SendAsync("?"..string.rep('\r',math.floor(185-(#tostring(args[1])/2)))..args[1])
- end
- end)
- newCommand({'bot','acc'},{'account number:number','command:string','args'},function(speaker, args)
- local order = getOrder(lp.Name)
- local bots = numberLister(args[1] or '')
- if table.find(bots,order) then
- local nargs = {}
- for i,v in args do
- if i<=2 then continue end
- table.insert(nargs, v)
- end
- runCommand(speaker, args[2], nargs)
- end
- end)
- newCommand({'cmdinfo','cinfo','commandinfo'},{'cmd:string'},function(speaker, args)
- local cmd = args[1]
- if cmd == nil then
- chatMessage('Provide a command.')
- else
- local got = getCommand(cmd)
- if got then
- local args = ''
- for i,v in got.args do
- args = `{args} <{v}>`
- end
- chatMessage(`{cmd}: {args}`)
- else
- chatMessage('No command found.')
- end
- end
- end)
- getgenv().botsystem.newscriptloaded.Event:Once(function()
- walkto = false
- watchlooped = false
- COBRA_Active = false
- wondering = false
- lp.Character.PrimaryPart.Anchored = false
- lp.Character.HumanoidRootPart.Anchored = false
- local hum = lp.Character:FindFirstChildWhichIsA('Humanoid')
- if hum.Sit then
- lp.Character.HumanoidRootPart.CFrame *= CFrame.new(0,hum.HipHeight+2,0)
- hum.Sit = false
- end
- if bangDied or bangLoop then
- if bangDied then bangDied:Disconnect() end
- bang:Stop()
- bangAnim:Destroy()
- if bangLoop then bangLoop:Disconnect() end
- end
- end)
- local function prepandruncommand(msg,shouldreturn)
- local source = msg.Text
- local textSource = msg.TextSource
- if textSource ~= nil and table.find(leaders,textSource.Name) then
- if source:sub(1,#prefix) == prefix then
- local newSource = source:sub(#prefix+1,#source)
- local chunks = newSource:split(' ')
- local command = chunks[1]
- table.remove(chunks,1)
- local args = chunks
- local speaker
- for i,v in pairs(plrs:GetPlayers()) do
- if v:IsA('Player') and v.Name == textSource.Name then
- speaker = v
- end
- end
- local s,e = pcall(function()
- runCommand(speaker, command, args)
- end)
- if not s then
- warn(e)
- chatMessage('An error occurred while running command:')
- sayError(e)
- end
- elseif source:sub(1,#'_') == '_' then
- local res = source:sub(#prefix+1,#source):lower()
- local agree = {
- 'yes',
- 'ye',
- 'y',
- 'yea',
- 'yeah',
- 'agree',
- 'accept',
- }
- local disagree = {
- 'n',
- 'no',
- 'nah',
- 'nope',
- 'deny',
- 'disagree',
- }
- if table.find(agree,res) then
- getgenv().botsystem.chatsystem['agree']:Fire()
- elseif table.find(disagree,res) then
- getgenv().botsystem.chatsystem['disagree']:Fire()
- end
- end
- end
- end
- local lastPing = nil
- local function pingWS()
- local WebSocket = getgenv().botsystem.websocket
- if WebSocket == nil then return false end
- WebSocket:Send('PING')
- return true
- end
- task.spawn(function()
- local WSConnect = syn and syn.websocket.connect or
- (Krnl and (function() repeat task.wait() until Krnl.WebSocket and Krnl.WebSocket.connect return Krnl.WebSocket.connect end)()) or
- WebSocket and WebSocket.connect
- local http = game:GetService('HttpService')
- local suc
- if table.find(leaders,lp.Name) then
- if WSConnect then
- -- rconsoleclear()
- local WebSocket = WSConnect("ws://127.0.0.1:"..port)
- getgenv().botsystem.websocket = WebSocket
- local gui = Instance.new('ScreenGui',game:GetService('CoreGui'))
- gui.Name = 'COBRA CONTROL'
- gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- table.insert(getgenv().botsystem.todestroy, gui)
- local main = Instance.new('Frame',gui)
- main.Size = UDim2.new(0,200,0,40)
- main.Position = UDim2.new(0,10,0,330)
- main.BackgroundColor3 = Color3.fromRGB(25,25,25)
- main.AutomaticSize = Enum.AutomaticSize.X
- local frame = Instance.new('Frame',main)
- frame.Size = UDim2.new(0,200,0,40)
- frame.Position = UDim2.new(0,0,0,0)
- frame.BackgroundTransparency = 1
- frame.AutomaticSize = Enum.AutomaticSize.X
- local a = Instance.new('Frame',frame)
- a.Size = UDim2.new(0,15,0,0)
- a.LayoutOrder = 1
- a.BackgroundTransparency = 1
- local b = Instance.new('Frame',frame)
- b.Size = UDim2.new(0,15,0,0)
- b.LayoutOrder = 3
- b.BackgroundTransparency = 1
- local fontSize = 20
- local tb = Instance.new('TextBox',frame)
- tb.Text = ''
- tb.LayoutOrder = 2
- tb.Size = UDim2.new(0,200,0,40)
- tb.TextColor3 = Color3.new(1,1,1)
- tb.ClearTextOnFocus = false
- tb.AutomaticSize = Enum.AutomaticSize.X
- tb.BackgroundTransparency = 1
- tb.TextTransparency = .9
- tb.TextSize = fontSize
- tb.Font = Enum.Font.Bodoni
- local mask = Instance.new('TextLabel',main)
- mask.Text = ''
- mask.AnchorPoint = Vector2.new(.5,.5)
- mask.Position = UDim2.fromScale(.5,.5)
- mask.Size = UDim2.new(0,200,0,40)
- mask.TextColor3 = Color3.new(1,1,1)
- mask.AutomaticSize = Enum.AutomaticSize.X
- mask.BackgroundTransparency = 1
- mask.TextTransparency = 0
- mask.TextSize = fontSize
- mask.RichText = true
- mask.Font = Enum.Font.Bodoni
- local uic = Instance.new('UICorner',main)
- local uill = Instance.new('UIListLayout',frame)
- uill.FillDirection = Enum.FillDirection.Horizontal
- uill.SortOrder = Enum.SortOrder.LayoutOrder
- local uis = Instance.new('UIStroke',main)
- uis.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
- uis.Color = Color3.new(.25,.25,.25)
- uis.Thickness = 2
- table.insert(getgenv().botsystem.connections,tb:GetPropertyChangedSignal("Text"):Connect(function()
- local splits = tb.Text:split(' ')
- --[[
- make loadstring blue
- more stuff
- add dropdown? (autofill takes it place atm)
- force cursor
- ]]
- if splits[1]:sub(1,#prefix) == prefix then
- local res = splits[1]:sub(#prefix+1)
- local out = '.'
- local command
- for i,v in splits do
- if i == 1 then
- local c = getCommand(res)
- if c then
- command = c
- out = out..'<b>'..res..'</b>'
- else
- local closestCmd = string.rep('long',10)
- local extra = ''
- local tabbed = res:sub(#res) == ' '
- if tabbed then
- res = res:sub(1,#res-1)
- end
- for _, c in commands do
- for _,n in c.names do
- if n:lower():sub(1,res:len()) == res:lower() then
- if n:len() < #closestCmd then
- closestCmd = n
- end
- end
- end
- end
- if tabbed then
- tb.Text = prefix..closestCmd..' '
- tb.CursorPosition = #tb.Text+1
- out = out..'<b>'..closestCmd..'</b>'
- else
- if string.rep('long',10) ~= closestCmd then
- extra = '<font transparency="0.25">'..closestCmd:sub(#res+1)..'</font>'
- end
- out = out..'<b><font color="rgb(255,75,75)">'..res..'</font></b>'..extra
- end
- end
- elseif command then
- local got = command.args[i-1] or ''
- local want = {}
- -- for i,val in got do
- local spl = got:split(':')
- if #spl >= 2 then
- local a = spl[2]:split('|')
- for i,typ in a do
- table.insert(want,typ)
- end
- end
- -- end
- if table.find(want,'bool') and v == 'true' or v == 'false' or v == 'nil' then
- out = out..' <b><font color="rgb(255,200,40)">'..v..'</font></b>'
- elseif table.find(want,'number') and tonumber(v) then
- out = out..' <font color="rgb(255,200,40)">'..v..'</font>'
- elseif table.find(want,'player') then
- local should = false
- -- if v == 'me' or v == 'random' then
- -- should = true
- -- else
- -- for i,p in pairs(plrs:GetPlayers()) do
- -- end
- -- end
- -- local gotPlayer = funcs.getPlayerUsingMetrics(lp,v)
- if #funcs.getPlayerUsingMetrics(lp,v) > 0 then
- should = true
- end
- if should then
- out = out..' <font color="rgb(243, 132, 247)">'..v..'</font>'
- else
- out = out..' <font color="rgb(255,75,75)">'..v..'</font>'
- end
- elseif table.find(want,'string') then
- out = out..' <font color="rgb(173, 241, 149)">'..v..'</font>'
- else
- out = out..' <font color="rgb(255,75,75)">'..v..'</font>'
- end
- else
- out = out..' '..v
- end
- end
- mask.Text = out
- elseif tb.Text:sub(1,1) == '_' then
- mask.Text = '<font color="rgb(255,255,255)">'..tb.Text..'</font>'
- else
- mask.Text = '<font color="rgb(255,75,75)">'..tb.Text..'</font>'
- end
- -- frame2.Size = UDim2.fromOffset(frame.AbsoluteSize)
- end))
- table.insert(getgenv().botsystem.connections,tb.FocusLost:Connect(function(enter)
- if enter then
- local data = {
- ['v1'] = false,
- ['source'] = tb.Text,
- ['speaker'] = lp.Name,
- ['command'] = '',
- ['args'] = {},
- }
- WebSocket:Send(http:JSONEncode(data))
- tb.Text = ''
- end
- end))
- end
- else
- if WSConnect then
- local success,WebSocket = pcall(WSConnect,"ws://127.0.0.1:"..port)
- suc = success
- if success then
- getgenv().botsystem.websocket = WebSocket
- WebSocket.OnMessage:Connect(function(json)
- if json == 'Active.' then
- lastPing = tick()
- else
- local tab = http:JSONDecode(json)
- -- if tab.speaker == lp.Name then return end
- if tab.v1 then
- runCommand(plrs:FindFirstChild(tab.speaker),tab.command,tab.args)
- else
- local msg = {
- ['Text'] = tab.source,
- ['TextSource'] = plrs:FindFirstChild(tab.speaker),
- }
- prepandruncommand(msg)
- end
- end
- end)
- else
- if canprint then
- rconsoleerr('Failed to connect to websocket: '..WebSocket)
- else
- warn('Failed to connect to websocket: '..WebSocket)
- end
- end
- end
- end
- if suc then
- while COBRA_Active do
- wait(1)
- local last = lastPing
- local start = tick()
- if pingWS() then
- repeat wait() until last ~= lastPing or tick()-start>2
- if tick()-start>2 then
- if COBRA_Active then
- if canprint then
- rconsoleerr('WEBSOCKET DISCONNECTED')
- else
- warn('WEBSOCKET DISCONNECTED')
- end
- end
- return
- end
- end
- end
- end
- end)
- plrs.PlayerRemoving:Connect(function(p)
- if COBRA_Active then
- if table.find(bots,p.Name) then
- if canprint then
- if getOrder(lp.Name) == 1 then
- rconsolewarn(p.Name..' just exited!')
- end
- end
- end
- end
- end)
- local s, e = pcall(function()
- TCS.OnIncomingMessage = function(msg)
- local s,e = pcall(function()
- if getgenv().botsystem == nil then chatMessage('Stored data is nil.') TCS.OnIncomingMessage = nil return end
- if cinfo.current ~= getgenv().botsystem.current or table.find(leaders,lp.Name) then
- walkto = false
- task.wait(1)
- TCS.OnIncomingMessage = nil
- return
- end
- prepandruncommand(msg)
- end)
- if not s then
- warn(e)
- chatMessage('An error occurred in TCS:')
- sayError(e)
- end
- end
- end)
- if not s then
- warn(e)
- chatMessage('An error occurred.')
- sayError(e)
- else
- if not table.find(leaders,lp.Name) then
- -- chatMessage(`COBRA // New version loaded. // {getgenv().botsystem.version}`)
- if getgenv().botsystem.antiidle then
- getgenv().botsystem.antiidle = false
- -- chatMessage(`COBRA Warning // Anti-Idle got disconnected. // Reconnecting...`)
- wait(.5)
- runCommand(lp,'antiidle',{})
- end
- if identifyexecutor() == 'Wave' then
- wait(1)
- -- chatMessage(':O Wave?!?!!? You must have given in..')
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment