Advertisement
RobloxLuaDeveloper

MM2 SIMPLE SCRIPT

Dec 7th, 2024 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.24 KB | None | 0 0
  1. -- MM2 OP Script [NO GUI]
  2.  
  3. local EnableAnimation = false -- true for Animation or false
  4. local AnimationsTable = {
  5. Idle = {[1] = "http://www.roblox.com/asset/?id=18537376492", [2] = "http://www.roblox.com/asset/?id=18537371272"},
  6. Walk = "http://www.roblox.com/asset/?id=18537392113",
  7. Run = "http://www.roblox.com/asset/?id=18537384940",
  8. Jump = "http://www.roblox.com/asset/?id=18537380791",
  9. Climb = "http://www.roblox.com/asset/?id=18537363391",
  10. Fall = "http://www.roblox.com/asset/?id=18537367238"
  11. }
  12.  
  13. if not game:IsLoaded() then
  14. print("Waiting game to Load. Please Wait! ⌛")
  15. game.Loaded:Wait()
  16. end
  17.  
  18. local PlaceId = 142823291
  19.  
  20. -- References --
  21. local cloneref = cloneref or function(o) return o end
  22. local Players = cloneref(game:GetService("Players"))
  23. local LocalPlayer = Players.LocalPlayer
  24. local PlayerScripts = cloneref(LocalPlayer:FindFirstChildOfClass("PlayerScripts"))
  25. local HiddenUI = cloneref(gethui() or game:GetService("CoreGui"))
  26. local StarterGui = cloneref(game:GetService("StarterGui"))
  27. local Workspace = cloneref(game:GetService("Workspace"))
  28. local ReplicatedStorage = cloneref(game:GetService("ReplicatedStorage"))
  29. local CollectionService = cloneref(game:GetService("CollectionService"))
  30. local RunService = cloneref(game:GetService("RunService"))
  31. local RawMetatable = getrawmetatable(game)
  32. local OldNameCall = RawMetatable.__namecall
  33.  
  34. -- Data(s) --
  35. local LocalPlayerData = {CollectedCoins = {}, LastCFrame}
  36. local SilentAim = {CurrentPrediction = Vector3.zero}
  37. local Map = {CurrentMap, CurrentGun}
  38.  
  39. -- Visualizer --
  40. local PartHolder = Instance.new("Folder", Workspace)
  41. local PredictionVisualizer = Instance.new("Part", PartHolder)
  42. PredictionVisualizer.Size = Vector3.new(.5, .5, .5)
  43. PredictionVisualizer.Shape = Enum.PartType.Ball
  44. PredictionVisualizer.Anchored = true
  45. PredictionVisualizer.CanCollide = false
  46. PredictionVisualizer.CastShadow = false
  47. PredictionVisualizer.Massless = true
  48. PredictionVisualizer.Position = Vector3.zero
  49. local Highlight = Instance.new("Highlight", PredictionVisualizer)
  50. Highlight.Adornee = PredictionBox
  51. Highlight.FillTransparency = 0
  52. Highlight.FillColor = Color3.new(1, 0, 0)
  53. Highlight.OutlineTransparency = 0.5
  54. Highlight.Enabled = true
  55.  
  56. -- Functions --
  57. local function Notify(Title, Message, Time)
  58. StarterGui:SetCore("SendNotification", (type(Title) == "string") and {Title = Title, Text = Message, Duration = Time or 5} or Title)
  59. end
  60.  
  61. local function RandomStrings()
  62. local Length, Array = math.random(10, 20), {}
  63. for i = 1, Length do
  64. Array[i] = string.char(math.random(32, 126))
  65. end
  66. return table.concat(Array)
  67. end
  68.  
  69. -- Checks --
  70. if _G.MurderMystery2ScriptNoGui then
  71. return Notify("Already Loaded", "Please re-Join if needed.")
  72. else
  73. _G.MurderMystery2ScriptNoGui = true
  74. end
  75.  
  76. if game.PlaceId ~= PlaceId then
  77. LocalPlayer:Kick("\nJoining MM2 ...")
  78. return TeleportService:Teleport(LocalPlayer, PlaceId)
  79. end
  80.  
  81. warn("Loaded : 1 / 2 🔃")
  82.  
  83. -- Visuals Folder --
  84. local VisualGUI = Instance.new("ScreenGui", HiddenUI)
  85. VisualGUI.Name, VisualGUI.DisplayOrder, VisualGUI.ResetOnSpawn = RandomStrings(), 999999999, false
  86.  
  87. local VisualHolder = Instance.new("Folder", VisualGUI)
  88. VisualHolder.Name = "VisualHolder"
  89.  
  90. local EspHolder = Instance.new("Folder", VisualHolder)
  91. EspHolder.Name = "Esp"
  92.  
  93. local GunHolder, PlayerHolder = Instance.new("Folder", EspHolder), Instance.new("Folder", EspHolder)
  94. GunHolder.Name, PlayerHolder.Name = "Gun", "Player"
  95.  
  96. local NameHolder, ChamHolder = Instance.new("Folder", PlayerHolder), Instance.new("Folder", PlayerHolder)
  97. NameHolder.Name, ChamHolder.Name = "Name", "Cham"
  98.  
  99. -- Colors --
  100. local Colors = {}
  101.  
  102. function Colors:GetColor(Object, Type)
  103. local ColorTable = {
  104. Innocent = {
  105. Solid = Color3.new(0, 255, 0),
  106. Cham = Color3.fromRGB(75, 151, 75),
  107. ESP = Color3.fromRGB(75, 255, 75)
  108. },
  109. Murderer = {
  110. Solid = Color3.new(255, 0, 0),
  111. Cham = Color3.fromRGB(196, 40, 28),
  112. ESP = Color3.fromRGB(255, 40, 29)
  113. },
  114. Sheriff = {
  115. Solid = Color3.new(0, 0, 255),
  116. Cham = Color3.fromRGB(98, 37, 209),
  117. ESP = Color3.fromRGB(75, 75, 255)
  118. },
  119. Hero = {
  120. Solid = Color3.new(255, 255, 0),
  121. Cham = Color3.fromRGB(245, 205, 48),
  122. ESP = Color3.fromRGB(245, 205, 48)
  123. },
  124. Gun = {
  125. Cham = Color3.fromRGB(121, 39, 176),
  126. ESP = Color3.fromRGB(98, 37, 209)
  127. }
  128. }
  129.  
  130. return Object and Type and ColorTable[Object][Type] or Object and not Type and ColorTable[Object] or ColorTable or nil
  131. end
  132.  
  133. -- Roles --
  134. local Roles = {RoleTable = {}, Murderers = {}, Sheriffs = {}, Hero, GameMode}
  135.  
  136. function Roles:IsAlive(Player)
  137. for Name, Data in pairs(self.RoleTable or {}) do
  138. if Player.Name == Name then return not Data.Dead end
  139. end
  140. return false
  141. end
  142.  
  143. function Roles:FindWeapon(WeaponName, Player, GetInstance)
  144. local FinalResult = nil
  145. pcall(function()
  146. if not (WeaponName and Player) then return end
  147. local function CheckWeapon(Weapon, IsLocal)
  148. if not (Weapon and Weapon:IsA("Tool")) then return end
  149. if Weapon.Name == "Gun" then
  150. local Handle, IsGun, KnifeServer, KnifeLocal = Weapon:FindFirstChild("Handle"), Weapon:FindFirstChild("IsGun"), Weapon:FindFirstChild("KnifeServer"), Weapon:FindFirstChild("KnifeLocal")
  151. if not (Handle and IsGun and KnifeServer and KnifeLocal) then return end
  152. local ShootGun = IsLocal and KnifeLocal:FindFirstChild("CreateBeam") and KnifeLocal.CreateBeam.RemoteFunction or KnifeServer:FindFirstChild("ShootGun")
  153.  
  154. return ShootGun and (GetInstance and {KnifeServer = KnifeServer, KnifeLocal = KnifeLocal, ShootGun = ShootGun, Handle = Handle} or true)
  155. elseif Weapon.Name == "Knife" then
  156. local Handle, KnifeServer, Stab, Throw = Weapon:FindFirstChild("Handle"), Weapon:FindFirstChild("KnifeServer"), Weapon:FindFirstChild("Stab"), Weapon:FindFirstChild("Throw")
  157. if not (Handle and KnifeServer and Stab and Throw) then return end
  158.  
  159. return GetInstance and {KnifeServer = KnifeServer, Stab = Stab, Throw = Throw, Handle = Handle} or true
  160. end
  161. end
  162.  
  163. local Parents = {Player.Character, Player:FindFirstChildOfClass("Backpack")}
  164. for _, Parent in pairs(Parents) do
  165. if Parent then
  166. local Weapon = Parent:FindFirstChild(WeaponName)
  167. local Result = Weapon and CheckWeapon(Weapon, Player == LocalPlayer)
  168. if Result then FinalResult = Result end
  169. end
  170. end
  171. end)
  172.  
  173. return FinalResult
  174. end
  175.  
  176. function Roles:ShootPlayerGun(Player, Args)
  177. local IsBreakGun = (Args and Args[2] == Vector2.zero)
  178. if not (Player and Args) then return end
  179.  
  180. local Gun = Roles:FindWeapon("Gun", Player, true)
  181. local ShootGun = Gun and (IsBreakGun or Gun.Handle.Parent.Parent:IsA("Model")) and Gun.ShootGun
  182. if not ShootGun then return end
  183.  
  184. task.spawn(function() pcall(function() ShootGun:InvokeServer(unpack(Args)) end) end)
  185. end
  186.  
  187. function Roles:UpdateRole()
  188. local GetPlayerData = ReplicatedStorage:FindFirstChild("Remotes") and ReplicatedStorage.Remotes:FindFirstChild("Extras") and ReplicatedStorage.Remotes.Extras:FindFirstChild("GetPlayerData", true)
  189. if not GetPlayerData then return end
  190.  
  191. pcall(function()
  192. self.RoleTable, self.CanGetRoles = GetPlayerData:InvokeServer(), true
  193. end)
  194.  
  195. local function UpdateVisual(PlayerName, Role)
  196. local TextLabel = NameHolder:FindFirstChild(PlayerName) and NameHolder[PlayerName]:FindFirstChildOfClass("BillboardGui") and NameHolder[PlayerName]:FindFirstChildOfClass("BillboardGui"):FindFirstChild(PlayerName)
  197. if TextLabel then
  198. TextLabel.TextColor3 = Colors:GetColor(Role, "ESP")
  199. end
  200.  
  201. local ChamFolder = ChamHolder:FindFirstChild(PlayerName.."_CHM")
  202. if ChamFolder then
  203. for _, Cham in pairs(ChamFolder:GetChildren()) do
  204. Cham.Color3 = Colors:GetColor(Role, "Cham")
  205. end
  206. end
  207. end
  208.  
  209. for Name, Data in pairs(self.RoleTable or Players:GetPlayers()) do
  210. local ThePlayer = self.RoleTable and Players:FindFirstChild(Name) or (not self.RoleTable and Data)
  211. if ThePlayer then
  212. if (self.RoleTable and Data.Role == "Murderer" and self:IsAlive(ThePlayer)) or (not self.RoleTable and self:FindWeapon("Knife", ThePlayer, false)) then
  213. if not table.find(self.Murderers, ThePlayer.Name) then table.insert(self.Murderers, ThePlayer.Name) end
  214. if ThePlayer ~= LocalPlayer then UpdateVisual(ThePlayer.Name, "Murderer") end
  215.  
  216. elseif (self.RoleTable and Data.Role == "Sheriff" and self:IsAlive(ThePlayer)) or (not self.RoleTable and self:FindWeapon("Gun", ThePlayer, false)) then
  217. if not table.find(self.Sheriffs, ThePlayer.Name) then table.insert(self.Sheriffs, ThePlayer.Name) end
  218. if ThePlayer ~= LocalPlayer then UpdateVisual(ThePlayer.Name, "Sheriff") end
  219.  
  220. elseif self.RoleTable and Data.Role == "Hero" and self:IsAlive(ThePlayer) and self:FindWeapon("Gun", ThePlayer, false) then
  221. self.Hero = ThePlayer.Name
  222. if ThePlayer ~= LocalPlayer then UpdateVisual(ThePlayer.Name, "Hero") end
  223.  
  224. else
  225. for Role, Player in pairs(self) do
  226. if tostring(Role) == "Sheriffs" or tostring(Role) == "Murderers" then
  227. local Finded = table.find(self[tostring(Role)], ThePlayer.Name)
  228. if Finded then table.remove(self[tostring(Role)], Finded) end
  229.  
  230. elseif tostring(Role) == "Hero" and Player == ThePlayer.Name then
  231. self.Hero = nil
  232.  
  233. end
  234. end
  235.  
  236. if ThePlayer ~= LocalPlayer then UpdateVisual(ThePlayer.Name, "Innocent") end
  237. end
  238. end
  239. end
  240. end
  241.  
  242. -- Rays --
  243. local Rays = {}
  244.  
  245. function Rays:GetPrediction(Type)
  246. local LocalRoot = LocalPlayer.Character and LocalPlayer.Character.PrimaryPart
  247. if not LocalRoot then return end
  248.  
  249. local function GetClosestPlayer(PlayerList)
  250. local ClosestPlayer, ClosestDistance = nil, math.huge
  251. for _, Player in pairs(PlayerList or Players:GetPlayers()) do
  252. if Player ~= LocalPlayer then
  253. local LocalRoot, OtherRoot = LocalPlayer.Character and LocalPlayer.Character.PrimaryPart, Player.Character and Player.Character.PrimaryPart
  254. if LocalRoot and OtherRoot then
  255. local Distance = (LocalRoot.Position - OtherRoot.Position).Magnitude
  256. if Distance < ClosestDistance then
  257. ClosestPlayer, ClosestDistance = Player, Distance
  258. end
  259. end
  260. end
  261. end
  262.  
  263. return ClosestPlayer
  264. end
  265.  
  266. local Result
  267.  
  268. if Type == "Gun" then
  269. local Murderers = {}
  270. for _, v in pairs(Roles.Murderers) do
  271. local ThePlayer = Players:FindFirstChild(v)
  272. if ThePlayer then table.insert(Murderers, ThePlayer) end
  273. end
  274.  
  275. local Murderer = GetClosestPlayer(Murderers)
  276. if Murderer then
  277. local MurdererRoot = Murderer.Character and Murderer.Character.PrimaryPart
  278. if MurdererRoot then
  279. local MurdererVelocity = MurdererRoot.AssemblyLinearVelocity
  280. Result = MurdererRoot.Position + ( MurdererVelocity * Vector3.new(1, 0, 1) * (math.random(22, 26) / 100) + Vector3.new(0, MurdererVelocity.Y * (math.random(40, 60) / 1000), 0) )
  281. end
  282. end
  283.  
  284. elseif Type == "Knife" then
  285. local Target = GetClosestPlayer()
  286. if Target then
  287. local TargetRoot = Target.Character and Target.Character.PrimaryPart
  288. if TargetRoot then
  289. local TargetVelocity = TargetRoot.AssemblyLinearVelocity
  290. Result = TargetRoot.Position + ( TargetVelocity * Vector3.new(1, 0, 1) * (math.random(30, 60) / 100) * ((LocalRoot.Position - TargetRoot.Position).Magnitude / math.random(25, 28)) + Vector3.new(0, TargetVelocity.Y * (math.random(40, 60) / 1000), 0) )
  291. end
  292. end
  293. end
  294.  
  295. return Result
  296. end
  297.  
  298. -- Visuals --
  299. local Visual = {Transparency = .8}
  300.  
  301. function Visual.ApplyVisuals(Player)
  302. task.spawn(function()
  303. local ChamFolder = Instance.new("Folder", ChamHolder)
  304. ChamFolder.Name = Player.Name .. "_CHM"
  305.  
  306. repeat task.wait() until Player.Character and Player.Character:FindFirstChildOfClass("Humanoid") and Player.Character.Humanoid.RootPart and Player.Character:FindFirstChild("Head") or not Player
  307. if not Player then return end
  308. local Character = Player.Character
  309. local Head = Character.Head
  310.  
  311. local NameFolder = Instance.new("Folder", NameHolder)
  312. NameFolder.Name = Player.Name
  313. local BillboardGui = Instance.new("BillboardGui", NameFolder)
  314. BillboardGui.Adornee = Head
  315. BillboardGui.Name = Head.Name
  316. BillboardGui.Size = UDim2.new(0, 100, 0, 150)
  317. BillboardGui.StudsOffset = Vector3.new(0, 1, 0)
  318. BillboardGui.AlwaysOnTop = true
  319.  
  320. local TextLabel = Instance.new("TextLabel", BillboardGui)
  321. TextLabel.BackgroundTransparency = 1
  322. TextLabel.Position = UDim2.new(0, 0, 0, -50)
  323. TextLabel.Size = UDim2.new(0, 100, 0, 100)
  324. TextLabel.Font = Enum.Font.Gotham
  325. TextLabel.TextSize = 12
  326. TextLabel.TextColor3 = Colors:GetColor("Innocent", "ESP")
  327. TextLabel.TextStrokeTransparency = 0
  328. TextLabel.TextYAlignment = Enum.TextYAlignment.Bottom
  329. TextLabel.Text = Player.Name
  330. TextLabel.ZIndex = 0
  331. TextLabel.Name = Player.Name
  332.  
  333. for _, Part in pairs(Character:GetChildren()) do
  334. if Part:IsA("BasePart") and Part.Name ~= ("Radio" and "HumanoidRootPart") then
  335. local Adornment = Instance.new("BoxHandleAdornment", ChamFolder)
  336. Adornment.Name = Part.Name
  337. Adornment.Adornee = Part
  338. Adornment.AlwaysOnTop = true
  339. Adornment.ZIndex = 0
  340. Adornment.Size = Part.Size
  341. Adornment.Transparency = Visual.Transparency
  342. Adornment.Color3 = Colors:GetColor("Innocent", "Cham")
  343. end
  344. end
  345. end)
  346. end
  347.  
  348. function Visual:PEsp(Adornee, Parent, Color3)
  349. local Adornment = Instance.new("BoxHandleAdornment", Parent)
  350. Adornment.Name = Adornee.Name.."_PESP"
  351. Adornment.Adornee = Adornee
  352. Adornment.AlwaysOnTop = true
  353. Adornment.ZIndex = 0
  354. Adornment.Size = Adornee.Size
  355. Adornment.Transparency = Visual.Transparency
  356. Adornment.Color3 = Color3
  357.  
  358. local Connection
  359. Connection = Adornee.Changed:Connect(function()
  360. if not Adornee.Parent then Adornment:Destroy() end
  361. end)
  362. end
  363.  
  364. function Visual:NEsp(Adornee, Parent, Color3, Text)
  365. local BillboardGui = Instance.new("BillboardGui", Parent)
  366. BillboardGui.Adornee = Adornee
  367. BillboardGui.Name = Adornee.Name.."_NESP"
  368. BillboardGui.Size = UDim2.new(0, 100, 0, 150)
  369. BillboardGui.StudsOffset = Vector3.new(0, 1, 0)
  370. BillboardGui.AlwaysOnTop = true
  371. local TextLabel = Instance.new("TextLabel", BillboardGui)
  372. TextLabel.BackgroundTransparency = 1
  373. TextLabel.Position = UDim2.new(0, 0, 0, -50)
  374. TextLabel.Size = UDim2.new(0, 100, 0, 100)
  375. TextLabel.Font = Enum.Font.Gotham
  376. TextLabel.TextSize = 12
  377. TextLabel.TextColor3 = Color3
  378. TextLabel.TextStrokeTransparency = 0
  379. TextLabel.TextYAlignment = Enum.TextYAlignment.Bottom
  380. TextLabel.Text = Text
  381. TextLabel.ZIndex = 0
  382.  
  383. local Connection
  384. Connection = Adornee.Changed:Connect(function()
  385. if not Adornee.Parent then BillboardGui:Destroy() end
  386. end)
  387. end
  388.  
  389. -- MAIN --
  390. PartHolder.Name, PredictionVisualizer.Name, Highlight.Name = RandomStrings(), RandomStrings(), RandomStrings()
  391.  
  392. for _, Player in pairs(Players:GetPlayers()) do
  393. if Player ~= LocalPlayer then Visual.ApplyVisuals(Player) end
  394. end
  395.  
  396. Players.PlayerAdded:Connect(Visual.ApplyVisuals)
  397.  
  398. Players.PlayerRemoving:Connect(function(Player)
  399. if Player ~= LocalPlayer then
  400. for Role, ThePlayer in pairs(Roles) do
  401. if tostring(Role) == "Sheriffs" or tostring(Role) == "Murderers" then
  402. local Finded = table.find(Roles[tostring(Role)], Player.Name)
  403. if Finded then table.remove(Roles[tostring(Role)], Finded) end
  404. elseif tostring(Role) == "Hero" and ThePlayer == Player.Name then
  405. Roles.Hero = nil
  406. end
  407. end
  408.  
  409. local PlayerVisuals = {NameHolder:FindFirstChild(Player.Name), ChamHolder:FindFirstChild(Player.Name.."_CHM")}
  410. for _, Visual in pairs(PlayerVisuals) do
  411. if Visual then Visual:Destroy() end
  412. end
  413. end
  414. end)
  415.  
  416. task.spawn(function()
  417. while task.wait(1) do
  418. task.spawn(function() Roles:UpdateRole() end)
  419.  
  420. for _, Player in pairs(Players:GetPlayers()) do
  421. if Player ~= LocalPlayer then
  422. local OtherCharacter = Player.Character
  423. local OtherRoot = OtherCharacter and OtherCharacter.PrimaryPart
  424. if OtherCharacter and OtherRoot then
  425. local IsAlive = Roles:IsAlive(Player)
  426.  
  427. local BillboardGui = NameHolder:FindFirstChild(Player.Name) and NameHolder[Player.Name]:FindFirstChildOfClass("BillboardGui")
  428. if BillboardGui then
  429. local Head = OtherCharacter:FindFirstChild(BillboardGui.Name)
  430. BillboardGui.Enabled = Head and IsAlive
  431. BillboardGui.Adornee = IsAlive and Head or nil
  432. end
  433.  
  434. local ChamFolder = ChamHolder:FindFirstChild(Player.Name.."_CHM")
  435. if ChamFolder then
  436. for _, Cham in pairs(ChamFolder:GetChildren()) do
  437. local Object = OtherCharacter:FindFirstChild(Cham.Name)
  438. Cham.Visible = Object and IsAlive or false
  439. Cham.Transparency = Visual.Transparency
  440. Cham.Adornee = IsAlive and Object or nil
  441. Cham.Size = IsAlive and Object and Object.Size or Vector3.zero
  442. end
  443. end
  444.  
  445. if Roles:FindWeapon("Gun", Player, false) then
  446. local Random = math.random(0, 10)
  447. local Result = (OtherRoot.Position + Vector3.new(Random * math.random(-1, 1), Random * math.random(-1, 1), Random * math.random(-1, 1)))
  448. Roles:ShootPlayerGun(Player, {[1] = 1, [2] = table.find(Roles.Murderers, LocalPlayer.Name) and Vector2.zero or Vector3.new(Random, Random, Random), [3] = "AH2"})
  449. end
  450. end
  451. end
  452. end
  453.  
  454. local Objects = {"CoinVisual", "ChromaDecal", "ChromaFire", "ChromaPart"}
  455. for _, Object in pairs(Objects) do
  456. for _, Instance in pairs(CollectionService:GetTagged(Object)) do
  457. if Object:lower():find("chroma") then
  458. Instance:Destroy()
  459. elseif Object == "CoinVisual" then
  460. local Parent = Instance.Parent
  461. if Parent then
  462. if Instance:GetAttribute("Collected") or Instance:GetAttribute("RoundEnd") or (table.find(LocalPlayerData.CollectedCoins, Instance:GetAttribute("CoinID")) and LocalPlayerData.CollectedCoins[Instance:GetAttribute("CoinID")].IsFull) then
  463. Parent:Destroy()
  464. else
  465. Instance.CFrame *= CFrame.Angles(0, math.rad(45), 0)
  466. Parent.Size = Vector3.new(10, 10, 10)
  467. end
  468. end
  469.  
  470. end
  471. end
  472. end
  473.  
  474. local function GetMap()
  475. for _, Child in pairs(Workspace:GetChildren()) do
  476. local Spawns, CoinContainer = Child:FindFirstChild("Spawns"), Child:FindFirstChild("CoinAreas") or Child:FindFirstChild("CoinContainer")
  477. if Child:IsA("Model") and not Players:GetPlayerFromCharacter(Child) and Spawns and CoinContainer then return {Map = Child, Spawns = Spawns, CoinContainer = CoinContainer} end
  478. end
  479. return
  480. end
  481.  
  482. if not Map.CurrentMap then
  483. local CurrentMap = GetMap()
  484. if CurrentMap then
  485. Map.CurrentMap = CurrentMap
  486.  
  487. local function CheckGun(Child)
  488. if Child:IsA("BasePart") and Child.Name == "GunDrop" then
  489. Map.CurrentGun = Child
  490. Visual:PEsp(Child, GunHolder, Colors:GetColor("Gun", "Cham"))
  491. Visual:NEsp(Child, GunHolder, Colors:GetColor("Gun", "ESP"), "Gun")
  492. Child.Size = Vector3.new(10, 10, 10)
  493.  
  494. local GunConnection
  495. GunConnection = Child.Changed:Connect(function()
  496. if not Child.Parent then
  497. Map.CurrentGun = nil
  498. GunConnection:Disconnect()
  499. end
  500. end)
  501. end
  502. end
  503.  
  504. for _, Child in pairs(CurrentMap.Map:GetChildren()) do
  505. CheckGun(Child)
  506. end
  507. CurrentMap.Map.ChildAdded:Connect(CheckGun)
  508.  
  509. local Connection
  510. Connection = CurrentMap.Map.Changed:Connect(function()
  511. if not CurrentMap.Map.Parent then
  512. Map.CurrentMap, LocalPlayerData.CollectedCoins, Roles.RoleTable, Roles.Murderers, Roles.Sheriffs, Roles.Hero = nil, {}, nil, {}, {}, nil
  513. Connection:Disconnect()
  514. end
  515. end)
  516. end
  517. end
  518.  
  519. local Character = LocalPlayer.Character
  520. if Character then
  521. local Knife = Roles:FindWeapon("Knife", LocalPlayer, true)
  522. if Knife and Knife.Handle then
  523. local Handle = Knife.Handle
  524. Handle.Massless, Handle.Anchored, Handle.CanCollide, Handle.Size = true, false, false, Vector3.new(5, 5, 5)
  525. end
  526.  
  527. local Humanoid = Character:FindFirstChildOfClass("Humanoid")
  528. if Humanoid then
  529. Humanoid.WalkSpeed = 18
  530. Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
  531. end
  532. end
  533. end
  534. end)
  535.  
  536. -- Stepped --
  537. RunService.RenderStepped:Connect(function()
  538. local Character = LocalPlayer.Character
  539. if Character then
  540. local Humanoid = Character:FindFirstChildOfClass("Humanoid")
  541. local LocalRoot = Humanoid and Humanoid.RootPart
  542.  
  543. if Humanoid and LocalRoot then
  544. if LocalRoot.Position.Y <= Workspace.FallenPartsDestroyHeight + 100 then
  545. local Spawn = Map.CurrentMap and Map.CurrentMap.Spawns:GetChildren()[1] or (Workspace:FindFirstChild("Lobby") and Workspace.Lobby:FindFirstChild("Spawns") and Workspace.Lobby.Spawns:GetChildren()[1]) or (LocalRoot.Position + Vector3.new(0, 5, 0))
  546. LocalRoot.CFrame = CFrame.new(Spawn.Position + Vector3.new(0, Spawn.Position.Y + Character:GetExtentsSize().Y * .5, 0))
  547. Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  548. end
  549.  
  550. for _, Tool in pairs(Character:GetChildren()) do
  551. if Tool:IsA("Tool") then
  552. local Handle = Tool:FindFirstChild("Handle")
  553. if Handle then Handle.Massless = true end
  554. end
  555. end
  556.  
  557. if (LocalRoot.AssemblyAngularVelocity.Magnitude > 150 or LocalRoot.AssemblyLinearVelocity.Magnitude > 250) then
  558. if LocalPlayerData.LastCFrame then
  559. LocalRoot.AssemblyLinearVelocity, LocalRoot.AssemblyAngularVelocity = Vector3.zero, Vector3.zero
  560. LocalRoot.CFrame = LocalPlayerData.LastCFrame
  561. Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  562. end
  563. else
  564. LocalPlayerData.LastCFrame = LocalRoot.CFrame
  565. end
  566.  
  567. for _, Player in pairs(Players:GetPlayers()) do
  568. if Player ~= LocalPlayer then
  569. local OtherRoot = Player.Character and Player.Character.PrimaryPart
  570. if OtherRoot and (OtherRoot.AssemblyAngularVelocity.Magnitude > 150 or OtherRoot.AssemblyLinearVelocity.Magnitude > 250) then
  571. OtherRoot.AssemblyLinearVelocity, OtherRoot.AssemblyAngularVelocity = Vector3.zero, Vector3.zero
  572. for _, Childs in pairs(OtherRoot.Parent:GetDescendants()) do
  573. if Childs:IsA("BasePart") then Childs.CanCollide = false end
  574. end
  575. end
  576. end
  577. end
  578.  
  579. if table.find(Roles.Sheriffs, LocalPlayer.Name) or Roles.Hero == LocalPlayer.Name then
  580. SilentAim.CurrentPrediction = Rays:GetPrediction("Gun") or SilentAim.CurrentPrediction
  581. elseif table.find(Roles.Murderers, LocalPlayer.Name) then
  582. SilentAim.CurrentPrediction = Rays:GetPrediction("Knife") or SilentAim.CurrentPrediction
  583. end
  584.  
  585. PredictionVisualizer.Position = SilentAim.CurrentPrediction
  586. end
  587. end
  588. end)
  589.  
  590. -- Heartbeat --
  591. RunService.Heartbeat:Connect(function()
  592. local LocalRoot = LocalPlayer.Character and LocalPlayer.Character.PrimaryPart
  593. if LocalRoot then
  594. if LocalRoot then
  595. local LastVelocity = LocalRoot.AssemblyLinearVelocity
  596. LocalRoot.AssemblyLinearVelocity = Vector3.new(0, -100, 0)
  597. RunService.RenderStepped:Wait()
  598. LocalRoot.AssemblyLinearVelocity = LastVelocity
  599. end
  600. end
  601. end)
  602.  
  603. -- Silent Aim --
  604. setreadonly(RawMetatable, false)
  605.  
  606. RawMetatable.__namecall = newcclosure(function(Object, ...)
  607. local NamecallMethod = getnamecallmethod()
  608. local Arguments = {...}
  609.  
  610. if NamecallMethod == "FireServer" and tostring(Object) == "Throw" then
  611. local Success, Error = pcall(function()
  612. Arguments[1] = CFrame.new(SilentAim.CurrentPrediction)
  613. end)
  614. if Error then warn("Error! :",Error) end
  615.  
  616. elseif NamecallMethod == "InvokeServer" and tostring(Object) == "RemoteFunction" then
  617. local Success, Error = pcall(function()
  618. Arguments[2] = SilentAim.CurrentPrediction
  619. end)
  620. if Error then warn("Error! :",Error) end
  621.  
  622. end
  623.  
  624. return OldNameCall(Object, unpack(Arguments))
  625. end)
  626.  
  627. setreadonly(RawMetatable, true)
  628.  
  629. -- Anti Lag --
  630. task.spawn(function()
  631. for _, Player in pairs(Players:GetPlayers()) do
  632. for _, WeaponName in pairs({"Gun", "Knife"}) do
  633. local Weapon = Roles:FindWeapon(WeaponName, Player, true)
  634. if Weapon then
  635. local GameMode = Weapon.KnifeServer:FindFirstChild("GameMode")
  636. if GameMode and GameMode:IsA("StringValue") then
  637. Roles.GameMode = GameMode.Value
  638. break
  639. end
  640. end
  641. end
  642. end
  643.  
  644. local Scripts = {"CoinVisualizer", PlayerScripts:FindFirstChild("WeaponVisuals") and PlayerScripts.WeaponVisuals:FindFirstChild("ChromaScript")}
  645. for _, Script in pairs(Scripts) do
  646. local LocalScript = PlayerScripts and (tostring(Script) and PlayerScripts:FindFirstChild(Script) or Script)
  647. if LocalScript then LocalScript:Destroy() end
  648. end
  649.  
  650. local Folders = {"Footsteps"}
  651.  
  652. for _, Folder in pairs(Workspace:GetChildren()) do
  653. if table.find(Folders, Folder.Name) and Folder:IsA("Folder") then
  654. Folder:Destroy()
  655. end
  656. end
  657.  
  658. Workspace.ChildAdded:Connect(function(Child)
  659. if Child.Name == "Footsteps" and Child:IsA("Folder") then
  660. task.wait()
  661. Child:Destroy()
  662. end
  663. end)
  664.  
  665. local RemotesName = {"CoinsStarted", "CoinCollected", "LoadingMap"}
  666. local GamePlay = ReplicatedStorage:WaitForChild("Remotes") and ReplicatedStorage.Remotes:WaitForChild("Gameplay")
  667. if GamePlay then
  668. for _, Remote in pairs(RemotesName) do
  669. local TheRemote = GamePlay:WaitForChild(Remote)
  670. if TheRemote then
  671. if Remote == "CoinsStarted" then
  672. TheRemote.OnClientEvent:Connect(function()
  673. LocalPlayerData.CollectedCoins = {}
  674. end)
  675.  
  676. elseif Remote == "CoinCollected" then
  677. TheRemote.OnClientEvent:Connect(function(...)
  678. local Args = {...}
  679. local CoinType, CoinCollected, CoinBagLimit = Args[1], Args[2], Args[3]
  680. if not table.find(LocalPlayerData.CollectedCoins, CoinType) then table.insert(LocalPlayerData.CollectedCoins, CoinType) end
  681. LocalPlayerData.CollectedCoins[CoinType] = {IsFull = false, Limit = CoinBagLimit}
  682.  
  683. if CoinBagLimit == CoinCollected then
  684. LocalPlayerData.CollectedCoins[CoinType] = {IsFull = true, Limit = CoinBagLimit}
  685. for _, CoinVisual in pairs(CollectionService:GetTagged("CoinVisual")) do
  686. if CoinVisual:GetAttribute("CoinID") == CoinType and CoinVisual.Parent then
  687. CoinVisual.Parent:Destroy()
  688. end
  689. end
  690. end
  691. end)
  692.  
  693. elseif Remote == "LoadingMap" then
  694. TheRemote.OnClientEvent:Connect(function(...)
  695. local Args = {...}
  696. local GameMode = Args[1]
  697. Roles.GameMode = GameMode
  698. Notify("Game Started", "GameMode is "..Roles.GameMode, 5)
  699. end)
  700.  
  701. end
  702. end
  703. end
  704. end
  705. end)
  706.  
  707. -- Animation Changer [Optional] --
  708. local function ChangeAnimation(AnimationsTable)
  709. if not AnimationsTable then return end
  710.  
  711. repeat task.wait() until LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Animate") and LocalPlayer.Character:FindFirstChildOfClass("Humanoid") or not LocalPlayer.Character
  712.  
  713. local Animate = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Animate")
  714. local Humanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
  715.  
  716. for i, v in pairs(AnimationsTable) do
  717. local Animation = tostring(i):lower()
  718. repeat task.wait() until Animate:FindFirstChild(Animation) or not LocalPlayer.Character
  719. end
  720.  
  721. if not LocalPlayer.Character then return end
  722.  
  723. Animate.Disabled = true
  724. for _, Animation in pairs(Humanoid:GetPlayingAnimationTracks()) do
  725. Animation:Stop()
  726. end
  727.  
  728. Animate.idle:GetChildren()[1].AnimationId, Animate.idle:GetChildren()[2].AnimationId = AnimationsTable.Idle[1], AnimationsTable.Idle[2]
  729. Animate.walk:GetChildren()[1].AnimationId = AnimationsTable.Walk
  730. Animate.run:GetChildren()[1].AnimationId = AnimationsTable.Run
  731. Animate.jump:GetChildren()[1].AnimationId = AnimationsTable.Jump
  732. Animate.climb:GetChildren()[1].AnimationId = AnimationsTable.Climb
  733. Animate.fall:GetChildren()[1].AnimationId = AnimationsTable.Fall
  734.  
  735. task.wait(1)
  736. Animate.Enabled = true
  737. Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  738. end
  739.  
  740. if EnableAnimation then
  741. ChangeAnimation(AnimationsTable)
  742. LocalPlayer.CharacterAdded:Connect(function() ChangeAnimation(AnimationsTable) end)
  743. end
  744.  
  745. warn("Loaded : 2 / 2 ✅")
  746.  
  747. Notify({
  748. Title = "Loaded ✅",
  749. Text = "Enjoy !",
  750. Duration = 60,
  751. Button1 = "Yeay!"
  752. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement