Advertisement
RobloxLuaDeveloper

MM2 FASTEST & SAFEST AUTOFARM (100K COINS / 50 HOURS)

Jul 9th, 2024 (edited)
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.69 KB | None | 1 1
  1. -- MM2 AutoFarm (TWEEN) --
  2.  
  3. if _G.MurderMystery2AutoFarmScriptNoGui then return end
  4. pcall(function() _G.MurderMystery2AutoFarmScriptNoGui = true end)
  5.  
  6. if not game:IsLoaded() then
  7. game.Loaded:Wait()
  8. end
  9.  
  10. local PlaceId, JobId = 142823291, game.JobId
  11.  
  12. -- References --
  13. local cloneref = cloneref or function(o) return o end
  14. local Players = cloneref(game:GetService("Players"))
  15. local LocalPlayer = Players.LocalPlayer
  16. local GuiService = cloneref(game:GetService("GuiService"))
  17. local PlayerScripts = LocalPlayer:FindFirstChildOfClass("PlayerScripts")
  18. local VirtualUser = cloneref(game:GetService("VirtualUser"))
  19. local Workspace = cloneref(game:GetService("Workspace"))
  20. local CollectionService = cloneref(game:GetService("CollectionService"))
  21. local ReplicatedStorage = cloneref(game:GetService("ReplicatedStorage"))
  22. local RunService = cloneref(game:GetService("RunService"))
  23. local TeleportService = cloneref(game:GetService("TeleportService"))
  24. local QueueTeleport = queue_on_teleport or (syn and syn.queue_on_teleport) or (fluxus and fluxus.queue_on_teleport)
  25. local HttpRequest = (syn and syn.request) or (http and http.request) or http_request or (fluxus and fluxus.request) or request
  26. local HttpService = cloneref(game:GetService("HttpService"))
  27.  
  28. local TweenService = cloneref(game:GetService("TweenService"))
  29.  
  30. if not QueueTeleport then warn("❌ [Incompatible Exploit] : Your exploit does not support queue_on_teleport") end
  31.  
  32. -- Data(s) --
  33. local LocalPlayerData = {CollectedCoins = {}, CanShoot = true, DontDisturb = false, Died = false, ResetAttempt = false, JoinAttempt = false, WaitTime = 0, TimePassed = 0}
  34. local Map = {CurrentMap, CurrentGun}
  35.  
  36. -- Character Position Handler --
  37. local PartHolder = Instance.new("Folder", Workspace)
  38. local FloatPart = Instance.new("Part", PartHolder)
  39. FloatPart.Size = Vector3.one
  40. FloatPart.Anchored = true
  41. FloatPart.Position = Vector3.zero
  42. FloatPart.Massless = true
  43. FloatPart.CanCollide = false
  44. FloatPart.CastShadow = false
  45. FloatPart.CFrame *= CFrame.Angles(math.rad(90), 0, 0)
  46.  
  47. -- Functions --
  48. local function RandomStrings()
  49. local Length, Array = math.random(10,20), {}
  50. for i = 1, Length do
  51. Array[i] = string.char(math.random(32, 126))
  52. end
  53. return table.concat(Array)
  54. end
  55.  
  56. local function ReJoin()
  57. task.spawn(function()
  58. if LocalPlayerData.JoinAttempt then return end
  59. if not QueueTeleport then return warn("❌ [Incompatible Exploit] : Your exploit does not support queue_on_teleport") end
  60.  
  61. LocalPlayerData.JoinAttempt = true
  62. while task.wait(1) do
  63. warn("ReJoining!")
  64. task.spawn(function()
  65. local Servers = {}
  66.  
  67. pcall(function()
  68. local Request = HttpRequest and HttpRequest({Url = string.format("https://games.roblox.com/v1/games/%d/servers/Public?sortOrder=Desc&limit=100&excludeFullGames=true", PlaceId)})
  69. local Body = Request and HttpService:JSONDecode(Request.Body)
  70.  
  71. if Body and Body.data then
  72. for i, v in next, Body.data do
  73. if type(v) == "table" and tonumber(v.playing) and tonumber(v.maxPlayers) and v.playing < v.maxPlayers and v.id ~= JobId then
  74. table.insert(Servers, 1, v.id)
  75. end
  76. end
  77. end
  78.  
  79. QueueTeleport("loadstring(game:HttpGet('https://pastebin.com/raw/YLVX19kg'))()")
  80. end)
  81.  
  82. task.wait(.5)
  83. _G.MurderMystery2AutoFarmScriptNoGui = false
  84. LocalPlayer:Kick("\nJoining MM2 ...")
  85.  
  86. if #Servers > 0 then
  87. TeleportService:TeleportToPlaceInstance(PlaceId, Servers[math.random(1, #Servers)], LocalPlayer)
  88. else
  89. TeleportService:Teleport(PlaceId, LocalPlayer)
  90. end
  91.  
  92. end)
  93. end
  94. end)
  95. end
  96.  
  97. -- LocalPlayer Functions --
  98. local function SecondLife(Boolean)
  99. local LocalHumanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
  100. if LocalHumanoid then LocalHumanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, not Boolean) end
  101. end
  102.  
  103. local function ResetCharacter()
  104. local LocalHumanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
  105. local LocalHead = LocalHumanoid and LocalHumanoid.Parent:FindFirstChild("Head")
  106. if LocalHumanoid and LocalHead then
  107. LocalPlayerData.ResetAttempt = true
  108. task.wait(.1)
  109. SecondLife(false)
  110. LocalHumanoid.Health = -math.huge
  111. LocalHead:Destroy()
  112. SecondLife(false)
  113. LocalHumanoid:ChangeState(Enum.HumanoidStateType.Dead)
  114. task.wait(.1)
  115. LocalPlayerData.ResetAttempt = false
  116. end
  117. end
  118.  
  119. -- Checks --
  120. if tostring(game.PlaceId) ~= tostring(PlaceId) then
  121. return ReJoin()
  122. end
  123.  
  124. -- Roles --
  125. local Roles = {RoleTable = {}, Murderers = {}, Sheriffs = {}, GameMode, RoundEnded = false}
  126.  
  127. function Roles:IsAlive(Player)
  128. for Name, Data in pairs(self.RoleTable or {}) do
  129. if Player.Name == Name then return not Data.Dead end
  130. end
  131. return false
  132. end
  133.  
  134. function Roles:FindWeapon(WeaponName, Player, GetInstance)
  135. local FinalResult = nil
  136. pcall(function()
  137. if not (WeaponName and Player) then return end
  138. local function CheckWeapon(Weapon, IsLocal)
  139. if not (Weapon and Weapon:IsA("Tool")) then return end
  140. if Weapon.Name == "Gun" then
  141. local Handle, IsGun, KnifeServer, KnifeLocal = Weapon:FindFirstChild("Handle"), Weapon:FindFirstChild("IsGun"), Weapon:FindFirstChild("KnifeServer"), Weapon:FindFirstChild("KnifeLocal")
  142. if not (Handle and IsGun and KnifeServer and KnifeLocal) then return end
  143. local ShootGun = IsLocal and KnifeLocal:FindFirstChild("CreateBeam") and KnifeLocal.CreateBeam.RemoteFunction or KnifeServer:FindFirstChild("ShootGun")
  144.  
  145. return ShootGun and (GetInstance and {KnifeServer = KnifeServer, KnifeLocal = KnifeLocal, ShootGun = ShootGun, Handle = Handle} or true)
  146. elseif Weapon.Name == "Knife" then
  147. local Handle, KnifeServer, Stab, Throw = Weapon:FindFirstChild("Handle"), Weapon:FindFirstChild("KnifeServer"), Weapon:FindFirstChild("Stab"), Weapon:FindFirstChild("Throw")
  148. if not (Handle and KnifeServer and Stab and Throw) then return end
  149.  
  150. return GetInstance and {KnifeServer = KnifeServer, Stab = Stab, Throw = Throw, Handle = Handle} or true
  151. end
  152. end
  153.  
  154. local Parents = {Player.Character, Player:FindFirstChildOfClass("Backpack")}
  155. for _, Parent in pairs(Parents) do
  156. if Parent then
  157. local Weapon = Parent:FindFirstChild(WeaponName)
  158. local Result = Weapon and CheckWeapon(Weapon, Player == LocalPlayer)
  159. if Result then FinalResult = Result end
  160. end
  161. end
  162. end)
  163.  
  164. return FinalResult
  165. end
  166.  
  167. function Roles:UpdateRole()
  168. local GetPlayerData = ReplicatedStorage:FindFirstChild("Remotes") and ReplicatedStorage.Remotes:FindFirstChild("Extras") and ReplicatedStorage.Remotes.Extras:FindFirstChild("GetPlayerData", true)
  169. if not GetPlayerData then return end
  170. pcall(function()
  171. self.RoleTable, self.CanGetRoles = GetPlayerData:InvokeServer(), true
  172. end)
  173.  
  174. for Name, Data in pairs(self.RoleTable or Players:GetPlayers()) do
  175. local ThePlayer = self.RoleTable and Players:FindFirstChild(Name) or (not self.RoleTable and Data)
  176. if ThePlayer then
  177. if (self.RoleTable and Data.Role == "Murderer" and self:IsAlive(ThePlayer)) or self:FindWeapon("Knife", ThePlayer, false) then
  178. if not table.find(self.Murderers, ThePlayer.Name) then table.insert(self.Murderers, ThePlayer.Name) end
  179. elseif (self.RoleTable and Data.Role == "Sheriff" and self:IsAlive(ThePlayer)) or self:FindWeapon("Gun", ThePlayer, false) then
  180. if not table.find(self.Sheriffs, ThePlayer.Name) then table.insert(self.Sheriffs, ThePlayer.Name) end
  181. else
  182. for Role, Player in pairs(self) do
  183. if tostring(Role) == "Sheriffs" or tostring(Role) == "Murderers" then
  184. local Finded = table.find(self[tostring(Role)], ThePlayer.Name)
  185. if Finded then table.remove(self[tostring(Role)], Finded) end
  186. end
  187. end
  188. end
  189. end
  190. end
  191. end
  192.  
  193. local AutoFarm = {Status = {Complete = false, Ready = true}, CurrentTween, CurrentCoin, FlingOffset = {XZ = math.random(-10, 10), Y = math.random(-10, 10)}}
  194.  
  195. function AutoFarm:GetClosestCoin()
  196. local Result, ClosestDistance = nil, math.huge
  197. local LocalRoot = LocalPlayer.Character and LocalPlayer.Character.PrimaryPart
  198. if not LocalRoot then return end
  199.  
  200. for _, CoinVisual in pairs(CollectionService:GetTagged("CoinVisual")) do
  201. local Parent = CoinVisual.Parent
  202. if Parent and Parent:FindFirstChildOfClass("TouchTransmitter") and not Parent:GetAttribute("Collected") and not Parent:GetAttribute("RoundEnd") then
  203. local Distance = (LocalRoot.Position - Parent.Position).Magnitude
  204.  
  205. if Distance < ClosestDistance then Result, ClosestDistance = Parent, Distance end
  206. end
  207. end
  208.  
  209. return Result
  210. end
  211.  
  212. -- MAIN :
  213.  
  214. PartHolder.Name, FloatPart.Name = RandomStrings(), RandomStrings()
  215.  
  216. RunService.RenderStepped:Connect(function()
  217. local LocalHumanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
  218. local LocalRoot = LocalHumanoid and LocalHumanoid.RootPart
  219.  
  220. LocalPlayerData.Died = not Roles:IsAlive(LocalPlayer)
  221.  
  222. if LocalHumanoid and LocalRoot then
  223. if Map.CurrentMap and not AutoFarm.Status.Complete and not LocalPlayerData.Died then
  224. LocalPlayerData.DontDisturb = false
  225. local ClosestCoin = AutoFarm:GetClosestCoin()
  226. if ClosestCoin then
  227. local GoalPosition = ClosestCoin.Position + Vector3.new(0, -5, 0)
  228. local Distance = (LocalRoot.Position - ClosestCoin.Position).Magnitude
  229.  
  230. if not AutoFarm.CurrentTween and AutoFarm.Status.Ready then
  231. local TweenResult = TweenService:Create(FloatPart, TweenInfo.new(Distance * .04, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Position = GoalPosition})
  232. AutoFarm.CurrentTween, AutoFarm.CurrentCoin = TweenResult, ClosestCoin
  233.  
  234. AutoFarm.CurrentTween.Completed:Connect(function()
  235. if (LocalRoot.Position - AutoFarm.CurrentCoin.Position).Magnitude < 10 then
  236. ClosestCoin.Size = Vector3.new(5, 5, 5)
  237. task.wait(.05)
  238. ClosestCoin.Size = Vector3.new(10, 10, 10)
  239. task.wait(math.random(5, 6) / 10)
  240. ClosestCoin:SetAttribute("Collected", true)
  241. end
  242. AutoFarm.CurrentTween, AutoFarm.Status.Ready = nil, true
  243. end)
  244.  
  245. AutoFarm.Status.Ready = false
  246. AutoFarm.CurrentTween:Play()
  247. elseif AutoFarm.CurrentCoin ~= ClosestCoin and AutoFarm.CurrentTween then
  248. AutoFarm.CurrentCoin = ClosestCoin
  249. AutoFarm.CurrentTween:Cancel()
  250. elseif Distance > 300 or Distance < 10 then
  251. if AutoFarm.CurrentTween then
  252. AutoFarm.CurrentTween:Cancel()
  253. end
  254. FloatPart.Position = GoalPosition
  255. end
  256. end
  257. elseif AutoFarm.Status.Complete or LocalPlayerData.Died then
  258. local Knife, Gun = Roles:FindWeapon("Knife", LocalPlayer, true), Roles:FindWeapon("Gun", LocalPlayer, true)
  259. if Knife then
  260. for _, Player in pairs(Players:GetPlayers()) do
  261. if Player ~= LocalPlayer and Roles.GameMode ~= "Classic" then
  262. LocalHumanoid:EquipTool(Knife.Handle.Parent)
  263. local Handle, Stab, OtherRoot = Knife.Handle, Knife.Stab, Player.Character and Player.Character.PrimaryPart
  264. if Handle and Stab and OtherRoot and Roles:IsAlive(Player) then
  265. Handle.Size, Handle.Massless, OtherRoot.CanCollide, OtherRoot.Size, OtherRoot.Massless, OtherRoot.Anchored, OtherRoot.Position = Vector3.new(10, 10, 10), true, false, Vector3.new(5, 5, 5), true, true, Handle.Position
  266. task.spawn(function() pcall(function() Stab:FireServer("Stab") end) end)
  267. end
  268. end
  269. end
  270. elseif not Roles.RoundEnded then
  271. local Murderer = (#Roles.Murderers > 0) and Players:FindFirstChild(Roles.Murderers[1])
  272. if Murderer and Murderer ~= LocalPlayer then
  273. LocalPlayerData.DontDisturb = true
  274. local MurdererRoot = Murderer.Character and Murderer.Character.PrimaryPart
  275. if MurdererRoot and MurdererRoot.AssemblyLinearVelocity.Magnitude < 250 and MurdererRoot.Position.Y > Workspace.FallenPartsDestroyHeight + 100 then
  276. Workspace.CurrentCamera.CameraSubject = MurdererRoot.Parent
  277. local MurdererVelocity = MurdererRoot.AssemblyLinearVelocity
  278. local Prediction = (MurdererRoot.Position + ( MurdererVelocity * Vector3.new(1, 0, 1) * ((AutoFarm.FlingOffset.XZ + (AutoFarm.FlingOffset.XZ == 0 and 1 or 0)) / 10) + Vector3.new(0, MurdererVelocity.Y / (AutoFarm.FlingOffset.Y + (AutoFarm.FlingOffset.Y == 0 and 1 or 0)), 0)))
  279. FloatPart.Position = Prediction
  280. if Gun then
  281. if Gun.Handle.Parent.Parent ~= LocalHumanoid.Parent then
  282. LocalHumanoid:EquipTool(Gun.Handle.Parent)
  283. end
  284. local PredictedPosition = MurdererRoot.Position + ( MurdererVelocity * Vector3.new(1, 0, 1) * (math.random(20, 28) / 100) + Vector3.new(0, MurdererVelocity.Y * (math.random(20, 60) / 1000), 0) )
  285. task.spawn(function()
  286. if LocalPlayerData.CanShoot then
  287. LocalPlayerData.CanShoot = false
  288. pcall(function()
  289. Gun.ShootGun:InvokeServer(unpack({[1] = 1, [2] = PredictedPosition, [3] = "AH2"}))
  290. end)
  291. LocalPlayerData.CanShoot = true
  292. end
  293. end)
  294. end
  295. else
  296. LocalPlayerData.DontDisturb = false
  297. end
  298. else
  299. LocalPlayerData.DontDisturb = false
  300. end
  301. end
  302. end
  303.  
  304. if Map.CurrentGun then Map.CurrentGun.Position = LocalRoot.Position end
  305.  
  306. if AutoFarm.Status.Complete and not LocalPlayerData.DontDisturb or Roles.RoundEnded then FloatPart.Position = Vector3.zero end
  307. LocalRoot.CFrame = FloatPart.CFrame
  308. if not LocalPlayerData.DontDisturb then Workspace.CurrentCamera.CameraSubject = FloatPart end
  309.  
  310. for _, Child in pairs(LocalHumanoid.Parent:GetDescendants()) do
  311. if Child:IsA("BasePart") then Child.CanCollide = false end
  312. end
  313. end
  314. end)
  315.  
  316. RunService.Heartbeat:Connect(function()
  317. local LocalRoot = LocalPlayer.Character and LocalPlayer.Character.PrimaryPart
  318. if LocalRoot then
  319. LocalRoot.AssemblyLinearVelocity = Vector3.new(0, LocalPlayerData.DontDisturb and -100e3 or 0, 0)
  320. RunService.RenderStepped:Wait()
  321. LocalRoot.AssemblyLinearVelocity = Vector3.zero
  322. end
  323. end)
  324.  
  325. task.spawn(function()
  326. while task.wait(.15) do
  327. AutoFarm.FlingOffset.XZ, AutoFarm.FlingOffset.Y = math.random(-10, 10), math.random(-10, 10)
  328. end
  329. end)
  330.  
  331. task.spawn(function()
  332. while task.wait(1) do
  333. task.spawn(function() Roles:UpdateRole() end)
  334. if not LocalPlayerData.ResetAttempt then SecondLife(true) end
  335.  
  336. local function ShootGun(Player, Args)
  337. local IsBreakGun = (Args and Args[2] == Vector2.new())
  338. if not (Player and Args) then return end
  339. local Gun = Roles:FindWeapon("Gun", Player, true)
  340. local ShootGun = Gun and (not IsBreakGun and Gun.Handle.Parent.Parent:IsA("Model") or IsBreakGun and true) and Gun.ShootGun
  341. if not ShootGun then return end
  342. task.spawn(function() pcall(function() ShootGun:InvokeServer(unpack(Args)) end) end)
  343. end
  344.  
  345. for _, Player in pairs(Players:GetPlayers()) do
  346. if Player ~= LocalPlayer then
  347. if Roles:FindWeapon("Gun", Player, false) then ShootGun(Player, {[1] = 1, [2] = Vector2.new(), [3] = "AH2"}) end
  348. end
  349. end
  350.  
  351. if not Map.CurrentMap then
  352. local function GetMap()
  353. for _, Child in pairs(Workspace:GetChildren()) do
  354. local Spawns, CoinContainer = Child:FindFirstChild("Spawns"), Child:FindFirstChild("CoinAreas") or Child:FindFirstChild("CoinContainer")
  355. if Child:IsA("Model") and not Players:GetPlayerFromCharacter(Child) and Spawns and CoinContainer then return {Map = Child, Spawns = Spawns, CoinContainer = CoinContainer} end
  356. end
  357. return
  358. end
  359.  
  360. local CurrentMap = GetMap()
  361. if CurrentMap then
  362. Map.CurrentMap = CurrentMap
  363.  
  364. local function CheckGun(Child)
  365. if Child:IsA("BasePart") and Child.Name == "GunDrop" then
  366. Map.CurrentGun = Child
  367. Child.Size = Vector3.new(10, 10, 10)
  368.  
  369. local GunConnection
  370. GunConnection = Child.Changed:Connect(function()
  371. if not Child.Parent then
  372. Map.CurrentGun = nil
  373. GunConnection:Disconnect()
  374. end
  375. end)
  376. end
  377. end
  378.  
  379. for _, Child in pairs(CurrentMap.Map:GetChildren()) do
  380. CheckGun(Child)
  381. end
  382. CurrentMap.Map.ChildAdded:Connect(CheckGun)
  383.  
  384. local Connection
  385. Connection = CurrentMap.Map.Changed:Connect(function()
  386. if not CurrentMap.Map.Parent then
  387. Map.CurrentMap, AutoFarm.Status.Complete, Roles.RoundEnded, LocalPlayerData.DontDisturb, LocalPlayerData.CollectedCoins = nil, true, true, false, {}
  388. Connection:Disconnect()
  389. end
  390. end)
  391. end
  392. end
  393.  
  394. local Objects = {"CoinVisual", "ChromaDecal", "ChromaFire", "ChromaPart"}
  395. for _, Object in pairs(Objects) do
  396. for _, Instance in pairs(CollectionService:GetTagged(Object)) do
  397. if Object:lower():find("chroma") then
  398. Instance:Destroy()
  399. elseif Object == "CoinVisual" then
  400. local Parent = Instance.Parent
  401. if Parent then
  402. if Instance:GetAttribute("Collected") or Instance:GetAttribute("RoundEnd") or (table.find(LocalPlayerData.CollectedCoins, Instance:GetAttribute("CoinID")) and LocalPlayerData.CollectedCoins[Instance:GetAttribute("CoinID")].IsFull) then
  403. if Instance:GetAttribute("RoundEnd") then
  404. AutoFarm.Status.Complete, Roles.RoundEnded = true, true
  405. end
  406. Parent:Destroy()
  407. else
  408. Parent.Size = Vector3.new(10, 10, 10)
  409. end
  410. end
  411. end
  412. end
  413. end
  414.  
  415. LocalPlayerData.WaitTime += 1
  416. LocalPlayerData.TimePassed += 1
  417. if #Players:GetPlayers() < 3 or LocalPlayerData.WaitTime > 180 or LocalPlayerData.TimePassed > 1200 then
  418. ReJoin()
  419. end
  420. end
  421. end)
  422.  
  423. task.spawn(function()
  424. for _, Player in pairs(Players:GetPlayers()) do
  425. for _, WeaponName in pairs({"Gun", "Knife"}) do
  426. local Weapon = Roles:FindWeapon(WeaponName, Player, true)
  427. if Weapon and Weapon.KnifeServer then
  428. local GameMode = Weapon.KnifeServer:FindFirstChild("GameMode")
  429. if GameMode and GameMode:IsA("StringValue") then
  430. Roles.GameMode = tostring(GameMode.Value)
  431. break
  432. end
  433. end
  434. end
  435. end
  436.  
  437. local Folders = {"Footsteps", "WeaponDisplays", "PetContainer"}
  438. for _, Folder in pairs(Workspace:GetChildren()) do
  439. if table.find(Folders, Folder.Name) and Folder:IsA("Folder") then
  440. Folder:Destroy()
  441. end
  442. end
  443.  
  444. Workspace.ChildAdded:Connect(function(Child)
  445. if Child.Name == "Footsteps" and Child:IsA("Folder") then
  446. task.wait()
  447. Child:Destroy()
  448. end
  449. end)
  450.  
  451. local Scripts = {"Pets", "CoinVisualizer", PlayerScripts:FindFirstChild("WeaponVisuals") and PlayerScripts.WeaponVisuals:FindFirstChild("ChromaScript")}
  452. for _, Script in pairs(Scripts) do
  453. local LocalScript = PlayerScripts and (tostring(Script) and PlayerScripts:FindFirstChild(Script) or Script)
  454. if LocalScript then LocalScript:Destroy() end
  455. end
  456.  
  457. local RemotesName = {"CoinsStarted", "CoinCollected", "LoadingMap"}
  458. local GamePlay = ReplicatedStorage:WaitForChild("Remotes") and ReplicatedStorage.Remotes:WaitForChild("Gameplay")
  459. if GamePlay then
  460. for _, Name in pairs(RemotesName) do
  461. local Remote = GamePlay:WaitForChild(Name)
  462. if Remote then
  463. if Name == "CoinsStarted" then
  464. Remote.OnClientEvent:Connect(function()
  465. AutoFarm.Status.Complete, Roles.RoundEnded, LocalPlayerData.DontDisturb, LocalPlayerData.CollectedCoins, LocalPlayerData.WaitTime = false, false, false, {}, 0
  466. end)
  467. elseif Name == "CoinCollected" then
  468. Remote.OnClientEvent:Connect(function(...)
  469. local Args = {...}
  470. local CoinType, CoinCollected, CoinBagLimit = Args[1], Args[2], Args[3]
  471. if not table.find(LocalPlayerData.CollectedCoins, CoinType) then table.insert(LocalPlayerData.CollectedCoins, CoinType) end
  472. LocalPlayerData.CollectedCoins[CoinType], LocalPlayerData.WaitTime = {IsFull = false, Limit = CoinBagLimit}, 0
  473. if CoinBagLimit == CoinCollected then
  474. LocalPlayerData.CollectedCoins[CoinType] = {IsFull = true, Limit = CoinBagLimit}
  475. for _, CoinVisual in pairs(CollectionService:GetTagged("CoinVisual")) do
  476. if CoinVisual:GetAttribute("CoinID") == CoinType and CoinVisual.Parent then
  477. CoinVisual.Parent:Destroy()
  478. end
  479. end
  480. local Completed = 0
  481. for _, CoinTypes in pairs(LocalPlayerData.CollectedCoins) do
  482. if CoinTypes.IsFull then Completed = Completed + 1 end
  483. end
  484. if Completed > 0 and #LocalPlayerData.CollectedCoins == Completed then
  485. AutoFarm.Status.Complete = true
  486. if table.find(Roles.Murderers, LocalPlayer.Name) and Roles.GameMode == "Classic" then ResetCharacter() end
  487. end
  488. end
  489. end)
  490. elseif Name == "LoadingMap" then
  491. Remote.OnClientEvent:Connect(function(...)
  492. local Args = {...}
  493. Roles.GameMode, AutoFarm.Status.Complete, LocalPlayerData.DontDisturb, LocalPlayerData.WaitTime = Args[1], false, false, 0
  494. end)
  495. end
  496. end
  497. end
  498. end
  499.  
  500. LocalPlayer.Idled:Connect(function()
  501. VirtualUser:CaptureController()
  502. VirtualUser:ClickButton2(Vector2.zero)
  503. end)
  504.  
  505. GuiService.ErrorMessageChanged:Connect(ReJoin)
  506. end)
  507.  
  508. local LastCharacter = LocalPlayer.Character
  509. LocalPlayer.CharacterAdded:Connect(function(Character)
  510. if Character ~= LastCharacter and Character and Players:GetPlayerFromCharacter(Character) then
  511. LastCharacter = Character
  512. Roles.Sheriffs, Roles.Murderers, Roles.RoleTable = {}, {}, nil
  513. FloatPart.Position, LocalPlayerData.DontDisturb, LocalPlayerData.CanShoot = Vector3.zero, false, true
  514. end
  515. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement