SHOW:
|
|
- or go back to the newest paste.
1 | --Converted with ttyyuu12345's model to script plugin v4 | |
2 | function sandbox(var,func) | |
3 | local env = getfenv(func) | |
4 | local newenv = setmetatable({},{ | |
5 | __index = function(self,k) | |
6 | if k=="script" then | |
7 | return var | |
8 | else | |
9 | return env[k] | |
10 | end | |
11 | end, | |
12 | }) | |
13 | setfenv(func,newenv) | |
14 | return func | |
15 | end | |
16 | cors = {} | |
17 | mas = Instance.new("Model",game:GetService("Lighting")) | |
18 | HopperBin0 = Instance.new("HopperBin") | |
19 | Part1 = Instance.new("Part") | |
20 | SpecialMesh2 = Instance.new("SpecialMesh") | |
21 | Script3 = Instance.new("Script") | |
22 | Script4 = Instance.new("Script") | |
23 | HopperBin0.Name = "ThermalVisor" | |
24 | HopperBin0.Parent = mas | |
25 | HopperBin0.TextureId = "http://www.roblox.com/asset/?id=16221893" | |
26 | Part1.Name = "Goggles" | |
27 | Part1.Parent = HopperBin0 | |
28 | Part1.Rotation = Vector3.new(0, 60.5099983, 0) | |
29 | Part1.Locked = true | |
30 | Part1.FormFactor = Enum.FormFactor.Plate | |
31 | Part1.Size = Vector3.new(1, 0.400000006, 2) | |
32 | Part1.CFrame = CFrame.new(-17.2041893, 0.592196524, 74.5575943, 0.492213935, 1.97089821e-06, 0.870474279, -2.98157147e-06, 1, -5.78221943e-07, -0.870474279, -2.31077229e-06, 0.492213935) | |
33 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
34 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
35 | Part1.Position = Vector3.new(-17.2041893, 0.592196524, 74.5575943) | |
36 | Part1.Orientation = Vector3.new(0, 60.5099983, 0) | |
37 | SpecialMesh2.Parent = Part1 | |
38 | SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=1278980" | |
39 | SpecialMesh2.Scale = Vector3.new(1.04999995, 1.04999995, 1.04999995) | |
40 | SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=10747907" | |
41 | SpecialMesh2.MeshType = Enum.MeshType.FileMesh | |
42 | SpecialMesh2.Scale = Vector3.new(1.04999995, 1.04999995, 1.04999995) | |
43 | Script3.Name = "ToolPickupScript" | |
44 | Script3.Parent = Part1 | |
45 | Script3.Disabled = true | |
46 | table.insert(cors,sandbox(Script3,function() | |
47 | function onTouch(hit) | |
48 | local player = game.Players:playerFromCharacter(hit.Parent) | |
49 | if player ~= nil then | |
50 | script.Parent.Parent.Parent = player.Backpack | |
51 | end | |
52 | script.Disabled = true | |
53 | end | |
54 | script.Parent.Touched:connect(onTouch) | |
55 | end)) | |
56 | Script4.Name = "ThermalVision by Malvaviscos" | |
57 | Script4.Parent = HopperBin0 | |
58 | table.insert(cors,sandbox(Script4,function() | |
59 | --by Malvaviscos | |
60 | --If you copy this model, please give me credit. | |
61 | waitTime = 1 -- Waiting time for scanning for humans. It scans EVERY object, so it's a good idea not to make it too low. | |
62 | ||
63 | local guiMain = Instance.new("GuiMain") | |
64 | local goggles = nil--Malvaviscos | |
65 | local connection = nil | |
66 | ||
67 | local thermalFrame = Instance.new("Frame") | |
68 | thermalFrame.Position = UDim2.new(0,0, 0,-20) | |
69 | thermalFrame.Size = UDim2.new(1,0, 1,0) | |
70 | thermalFrame.BackgroundColor = BrickColor.new("Bright orange") | |
71 | thermalFrame.BorderColor = thermalFrame.BackgroundColor | |
72 | thermalFrame.Transparency = 0.9 | |
73 | - | thermalFrame.Transparency = 0.5 |
73 | + | |
74 | thermalFrame.SizeConstraint = "RelativeXX" | |
75 | thermalFrame.Parent = guiMain | |
76 | ||
77 | local thermalSelections = {} | |
78 | local player = nil | |
79 | ||
80 | function getHumanoid(model) | |
81 | for i,child in pairs(model:getChildren()) do | |
82 | if child.className == "Humanoid" then | |
83 | return child | |
84 | end | |
85 | end | |
86 | end | |
87 | ||
88 | function isInTable(obj, table)--Malvaviscos | |
89 | for i,child in pairs(table) do | |
90 | if obj == child then--Malvaviscos | |
91 | return true | |
92 | end | |
93 | end | |
94 | return false | |
95 | end | |
96 | --Malvaviscos | |
97 | function lastParent(obj) | |
98 | local object = obj | |
99 | local parent = object.Parent | |
100 | while true do | |
101 | if parent == workspace or parent == game.Lighting or parent == nil then | |
102 | return object | |
103 | else | |
104 | object = parent | |
105 | parent = object.Parent | |
106 | end | |
107 | end | |
108 | end--Malvaviscos | |
109 | ||
110 | function selectAllPartsOfHuman(obj) | |
111 | if obj.className == "Part" or obj.className == "Seat" or obj.className == "TrussPart" then | |
112 | local selection = Instance.new("SelectionBox") | |
113 | selection.Adornee = obj | |
114 | selection.Color = BrickColor.new("Really blue") | |
115 | selection.Name = "Selection "..obj.Name | |
116 | selection.Parent = thermalFrame | |
117 | obj.AncestryChanged:connect(--Malvaviscos | |
118 | function() | |
119 | if obj.Parent == nil or lastParent(obj).Parent ~= workspace then | |
120 | selection:remove() | |
121 | end | |
122 | end | |
123 | ) | |
124 | else | |
125 | for i,child in pairs(obj:getChildren()) do | |
126 | selectAllPartsOfHuman(child) | |
127 | end | |
128 | end | |
129 | end | |
130 | ||
131 | function scanForHumanoids(obj)--Malvaviscos--Malvaviscos | |
132 | if obj.className == "Humanoid" then | |
133 | if obj.Parent ~= game.Players.LocalPlayer.Character then | |
134 | if not isInTable(obj.Parent, thermalSelections) then | |
135 | table.insert(thermalSelections, obj.Parent) | |
136 | selectAllPartsOfHuman(obj.Parent) | |
137 | obj.Parent.ChildAdded:connect(function() selectAllPartsOfHuman(obj.Parent) end) | |
138 | end | |
139 | end | |
140 | else | |
141 | for i,child in pairs(obj:getChildren()) do | |
142 | scanForHumanoids(child) | |
143 | end--Malvaviscos | |
144 | end | |
145 | end | |
146 | ||
147 | function onKeyDown(key) | |
148 | key = key:lower() | |
149 | if key == "" then | |
150 | if player.Character ~= nil and player.Character:findFirstChild("Head") ~= nil then | |
151 | local newTool = script.Parent:clone() | |
152 | newTool.Goggles.CFrame = player.Character.Head.CFrame * CFrame.new(0,0,-4) | |
153 | newTool.Goggles.ToolPickupScript.Disabled = false | |
154 | newTool.Active = false | |
155 | newTool.Parent = workspace | |
156 | onDeselected() | |
157 | script.Parent:remove() | |
158 | end | |
159 | end | |
160 | if key == "e" then | |
161 | onDeselected() | |
162 | end | |
163 | end | |
164 | ||
165 | function onSelected(mouse) | |
166 | player = game.Players.LocalPlayer | |
167 | mouse.KeyDown:connect(onKeyDown) | |
168 | if player.Character ~= nil and guiMain.Parent == nil then | |
169 | if player.Character:findFirstChild("HeatVisionGoggles") == nil and player.Character:findFirstChild("Head") ~= nil then | |
170 | goggles = script.Parent.Goggles:clone() | |
171 | goggles.Parent = player.Character | |
172 | local weld = Instance.new("Weld") | |
173 | weld.Part0 = player.Character.Head | |
174 | weld.Part1 = goggles--Malvaviscos | |
175 | weld.C1 = CFrame.new(0,-0.25,0.05) | |
176 | weld.Parent = goggles | |
177 | end | |
178 | end | |
179 | if player:findFirstChild("PlayerGui") == nil then | |
180 | Instance.new("PlayerGui").Parent = player | |
181 | end | |
182 | guiMain.Parent = player.PlayerGui--Malvaviscos | |
183 | scanForHumanoids(workspace) | |
184 | connection = workspace.ChildAdded:connect( | |
185 | function(child) | |
186 | if getHumanoid(child) ~= nil then | |
187 | table.insert(thermalSelections, child) | |
188 | selectAllPartsOfHuman(child) | |
189 | child.ChildAdded:connect(function() selectAllPartsOfHuman(child) end) | |
190 | end | |
191 | end) | |
192 | end | |
193 | script.Parent.Selected:connect(onSelected) | |
194 | ||
195 | function onDeselected() | |
196 | guiMain.Parent = nil--Malvaviscos | |
197 | if goggles ~= nil then | |
198 | goggles:remove() | |
199 | goggles = nil | |
200 | end | |
201 | if connection ~= nil then | |
202 | connection:disconnect() | |
203 | connection = nil | |
204 | end | |
205 | end | |
206 | --script.Parent.Deselected:connect(onDeselected) | |
207 | --Malvaviscos | |
208 | --Malvaviscos | |
209 | end)) | |
210 | for i,v in pairs(mas:GetChildren()) do | |
211 | v.Parent = game:GetService("Players").LocalPlayer.Backpack | |
212 | pcall(function() v:MakeJoints() end) | |
213 | end | |
214 | mas:Destroy() | |
215 | for i,v in pairs(cors) do | |
216 | spawn(function() | |
217 | pcall(v) | |
218 | end) | |
219 | end |