Repository navigation
Expand file tree
/
Copy pathmain.lua
More file actions
191 lines (155 loc) · 4.68 KB
/
Copy pathmain.lua
File metadata and controls
191 lines (155 loc) · 4.68 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
local Highlight = {}
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Lighting = game:GetService("Lighting")
local CoreGui = game:GetService("CoreGui")
local LocalPlayer = Players.LocalPlayer
local HighlightGui, HighlightFrame
function Highlight.CreateGui(Transparency)
HighlightGui = Instance.new("ScreenGui", CoreGui)
HighlightFrame = Instance.new("ViewportFrame", HighlightGui)
HighlightGui.IgnoreGuiInset = true
HighlightGui.Name = "HighlightGui"
HighlightGui.Enabled = true
HighlightGui.ResetOnSpawn = false
HighlightFrame.Name = "HighlightFrame"
HighlightFrame.Ambient = Color3.new(1, 1, 1)
HighlightFrame.LightColor = Color3.fromRGB(255, 255, 255)
HighlightFrame.Size = UDim2.fromScale(1, 1)
HighlightFrame.AnchorPoint = Vector2.new(0.5, 0.5)
HighlightFrame.Position = UDim2.fromScale(0.5, 0.5)
HighlightFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
HighlightFrame.BackgroundTransparency = 1
HighlightFrame.CurrentCamera = Workspace.CurrentCamera
HighlightFrame.ImageTransparency = Transparency or 0.5
end
function Highlight.HighlightPart(Part, Color)
local Color = Color or Color3.new(1, 1, 1)
if typeof(Color) == "BrickColor" then
Color = Color.Color
end
local Clone = Part:Clone()
Clone.Parent = HighlightFrame
Clone.Transparency = 0
Clone.Material = Enum.Material.Neon
Clone.Color = Color
if Clone:IsA("MeshPart") then
Clone.TextureID = ""
end
RunService.RenderStepped:Connect(function()
Clone.CFrame = Part.CFrame
end)
for _, v in pairs(Part:GetDescendants()) do
if v:IsA("LuaSourceContainer") then
v:Destroy()
end
end
Part.Changed:Connect(function(Property)
pcall(function()
if Property ~= "BrickColor" and Property ~= "Color" then
if Property ~= "Transparency" and Property ~= "Material" then
Clone[Property] = Part[Property]
end
end
end)
end)
Part.AncestryChanged:Connect(function(Child,Parent)
if not Parent and Child ~= Part then
Clone:Destroy()
end
end)
Part.Changed:Connect(function(Property)
if Property == "Parent" and Part.Parent == nil then
Clone:Destroy()
end
end)
for _, v in pairs(Clone:GetChildren()) do
if v:IsA("SpecialMesh") then
v.TextureId= ""
elseif v:IsA("Texture") or v:IsA("Decal") then
v:Destroy()
end
end
return Clone
end
function Highlight.HighlightBody(BodyModel, Color, AllowClothing)
local Color = Color or Color3.new(1, 1, 1)
local AllowClothing = AllowClothing or false
if typeof(Color) == "BrickColor" then
Color = Color.Color
end
local HumanoidModel = Instance.new("Model", HighlightFrame)
local Humanoid = Instance.new("Humanoid", HumanoidModel)
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local Parts = {}
for _, v in pairs(BodyModel:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "HumanoidRootPart" then
local Part = Highlight.HighlightPart(v, Color)
Part.Parent = HumanoidModel
table.insert(Parts, Part)
end
end
end
for _, v in pairs(BodyModel:GetDescendants()) do
if v:IsA("BasePart") and v.Parent ~= BodyModel then
local Part = Highlight.HighlightPart(v, Color)
Part.Parent = HumanoidModel
table.insert(Parts, Part)
elseif v:IsA("CharacterMesh") then
local Clone = v:Clone()
Clone:ClearAllChildren()
Clone.Parent = HumanoidModel
elseif v:IsA("BodyColors") or v:IsA("Shirt") or v:IsA("ShirtGraphic") or v:IsA("Pants") then
if AllowClothing then
local Clone = v:Clone()
Clone:ClearAllChildren()
Clone.Parent = HumanoidModel
end
end
end
for _, v in pairs(Parts) do
v.Color = Color
end
return HumanoidModel
end
function Highlight.HighlightModel(BodyModel,Color)
local Color = Color or Color3.new(1, 1, 1)
if typeof(Color) == "BrickColor" then
Color = Color.Color
end
local NewModel = Instance.new("Model", HighlightFrame)
local Parts = {}
for _, v in pairs(BodyModel:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "HumanoidRootPart" then
local Part = Highlight.HighlightPart(v, Color)
Part.Parent = NewModel
table.insert(Parts, Part)
end
end
end
for _,v in pairs(BodyModel:GetDescendants()) do
if v:IsA("BasePart") and v.Parent ~= BodyModel then
local Part = Highlight.HighlightPart(v, Color)
Part.Parent = NewModel
table.insert(Parts, Part)
end
end
for _, v in pairs(Parts) do
v.Color = Color
end
return NewModel
end
function Highlight.GetGuiObjects()
return HighlightFrame, HighlightGui
end
function Highlight.RemoveHighlightGuis()
for _, v in pairs(CoreGui:GetChildren()) do
if v.Name == "HighlightGui" and v:IsA("ScreenGui") and v:FindFirstChild("HighlightFrame") then
v:Destroy()
end
end
end
return Highlight