-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLua
More file actions
119 lines (105 loc) · 4.27 KB
/
Lua
File metadata and controls
119 lines (105 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
--// MM2 ESP + AutoShoot w/ Role Colors and Line-of-Sight
if game.PlaceId ~= 142823291 then
warn("Not in MM2.")
return
end
-- Services
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RunService = game:GetService("RunService")
-- UI Setup
local gui = Instance.new("ScreenGui", game.CoreGui)
local frame = Instance.new("Frame", gui)
frame.Size = UDim2.new(0, 200, 0, 120)
frame.Position = UDim2.new(0, 20, 0, 200)
frame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
local function makeToggle(text, y, callback)
local btn = Instance.new("TextButton", frame)
btn.Size = UDim2.new(0, 180, 0, 30)
btn.Position = UDim2.new(0, 10, 0, y)
btn.Text = text
btn.BackgroundColor3 = Color3.fromRGB(35, 35, 35)
btn.TextColor3 = Color3.new(1,1,1)
btn.MouseButton1Click:Connect(callback)
end
-- ESP Logic
local espEnabled = false
local espConnections = {}
local function updateESP()
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= LocalPlayer and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
local highlight = plr.Character:FindFirstChild("ESP")
if not highlight then
highlight = Instance.new("Highlight")
highlight.Name = "ESP"
highlight.Parent = plr.Character
end
local hasKnife = plr.Backpack:FindFirstChild("Knife") or plr.Character:FindFirstChild("Knife")
local hasGun = plr.Backpack:FindFirstChild("Gun") or plr.Character:FindFirstChild("Gun")
if hasKnife then
highlight.FillColor = Color3.new(1, 0, 0) -- Red for murderer
elseif hasGun then
highlight.FillColor = Color3.new(0, 0.5, 1) -- Blue for sheriff
else
highlight.FillColor = Color3.new(1, 1, 1) -- White for others
end
highlight.OutlineColor = Color3.new(0, 0, 0)
end
end
end
local function toggleESP()
espEnabled = not espEnabled
if espEnabled then
table.insert(espConnections, RunService.RenderStepped:Connect(updateESP))
else
for _, plr in ipairs(Players:GetPlayers()) do
if plr.Character and plr.Character:FindFirstChild("ESP") then
plr.Character.ESP:Destroy()
end
end
for _, conn in ipairs(espConnections) do
conn:Disconnect()
end
espConnections = {}
end
end
-- AutoShoot Logic
local autoShoot = false
local function toggleAutoShoot()
autoShoot = not autoShoot
if not autoShoot then return end
task.spawn(function()
while autoShoot do
task.wait(0.1)
local char = LocalPlayer.Character
local gun = char and char:FindFirstChild("Gun")
if gun then
for _, plr in ipairs(Players:GetPlayers()) do
if plr ~= LocalPlayer and plr.Character then
local knife = plr.Backpack:FindFirstChild("Knife") or plr.Character:FindFirstChild("Knife")
local hrp = plr.Character:FindFirstChild("HumanoidRootPart")
if knife and hrp then
-- Check line of sight
local origin = workspace.CurrentCamera.CFrame.Position
local direction = (hrp.Position - origin).Unit * 999
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {LocalPlayer.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.IgnoreWater = true
local result = workspace:Raycast(origin, direction, raycastParams)
if result and result.Instance and result.Instance:IsDescendantOf(plr.Character) then
game.ReplicatedStorage.Remotes.ShootGun:FireServer(hrp.Position)
end
end
end
end
end
end
end)
end
-- Buttons
makeToggle("Toggle ESP", 10, toggleESP)
makeToggle("Toggle AutoShoot", 50, toggleAutoShoot)