Advertisement
firebudgy

Untitled

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