Advertisement
Godofadmin1337

remote explosive detonator

Nov 15th, 2017
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.26 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. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. SpecialMesh2 = Instance.new("SpecialMesh")
  22. LocalScript3 = Instance.new("LocalScript")
  23. Script4 = Instance.new("Script")
  24. LocalScript5 = Instance.new("LocalScript")
  25. IntValue6 = Instance.new("IntValue")
  26. Tool0.Name = "RemoteDetonator"
  27. Tool0.Parent = mas
  28. Tool0.TextureId = "http://www.roblox.com/asset/?id=74322561"
  29. Tool0.GripForward = Vector3.new(-0, -1, 0)
  30. Tool0.GripPos = Vector3.new(0, 0.100000001, 0)
  31. Tool0.GripRight = Vector3.new(-1, 0, 0)
  32. Tool0.GripUp = Vector3.new(0, 0, 1)
  33. Part1.Name = "Handle"
  34. Part1.Parent = Tool0
  35. Part1.Rotation = Vector3.new(-84.0299988, 0.0399999991, 179.119995)
  36. Part1.RotVelocity = Vector3.new(1, 1, 1)
  37. Part1.Locked = true
  38. Part1.FormFactor = Enum.FormFactor.Custom
  39. Part1.Size = Vector3.new(0.399997801, 0.389998913, 1.9799993)
  40. Part1.CFrame = CFrame.new(-49977.3867, -49982.8906, -50039.5547, -0.999882221, -0.0153170722, 0.000773677719, 0.0023618862, -0.10394416, 0.994580269, -0.0151536465, 0.994465113, 0.103968121)
  41. Part1.Position = Vector3.new(-49977.3867, -49982.8906, -50039.5547)
  42. Part1.Orientation = Vector3.new(-84.0299988, 0.429999977, 178.699997)
  43. SpecialMesh2.Parent = Part1
  44. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=74322546"
  45. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  46. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=74322558"
  47. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  48. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  49. LocalScript3.Name = "Local Gui"
  50. LocalScript3.Parent = Tool0
  51. table.insert(cors,sandbox(LocalScript3,function()
  52. Tool = script.Parent
  53.  
  54. local stillEquipped = false
  55.  
  56. function onEquippedLocal(mouse)
  57. stillEquipped = true
  58. if mouse == nil then
  59. print("Mouse not found")
  60. return
  61. end
  62. while stillEquipped do
  63. print("Setting Mouse to go")
  64. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  65. while Tool.Enabled and stillEquipped do
  66. wait(0.01)
  67. end
  68. print("Setting Mouse to wait")
  69. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  70. while not Tool.Enabled and stillEquipped do
  71. wait(0.01)
  72. end
  73. end
  74. end
  75.  
  76.  
  77. function onUnequippedLocal()
  78. stillEquipped = false
  79. end
  80.  
  81. Tool.Equipped:connect(onEquippedLocal)
  82. Tool.Unequipped:connect(onUnequippedLocal)
  83. end))
  84. Script4.Name = "BombScript"
  85. Script4.Parent = Tool0
  86. table.insert(cors,sandbox(Script4,function()
  87. local Tool = script.Parent
  88. local Remote = Tool.Handle
  89.  
  90. local vCharacter
  91. local myTorso
  92. local myHumanoid
  93.  
  94. Tool.Enabled = true
  95.  
  96. local c4Clone
  97.  
  98. local exploded
  99.  
  100. local debris = game:GetService("Debris")
  101.  
  102. function onActivated()
  103. if Tool.Enabled == false then
  104. return
  105. end
  106.  
  107. if myTorso == nil or myHumanoid == nil then
  108. return
  109. end
  110.  
  111. Tool.Enabled = false
  112.  
  113. if not c4Clone or not c4Clone.Parent or exploded then
  114. exploded = false
  115. local target = myHumanoid.TargetPoint
  116. local lookAt = (target - Remote.Position).unit
  117.  
  118. local findPart = game.Workspace:FindPartOnRay(Ray.new(Remote.Position, lookAt * 8.0), vCharacter)
  119. if findPart then
  120. c4Clone = Remote:Clone()
  121. c4Clone.CFrame = Remote.CFrame
  122. c4Clone.Velocity = lookAt * 9.0
  123. c4Clone.Parent = game.Workspace
  124. c4Clone.CanCollide = true
  125.  
  126. c4Clone.Touched:connect(function(part)
  127. if part and part.Parent and part.Parent ~= vCharacter and part.Parent ~= Tool then
  128. local c4Weld = Instance.new("Weld")
  129. c4Weld.Part0 = part
  130. c4Weld.Part1 = c4Clone
  131. c4Weld.Name = "C4Weld"
  132. c4Weld.Parent = c4Clone
  133. c4Weld.C1 = part.CFrame * c4Clone.CFrame:inverse()
  134. end
  135. end)
  136.  
  137. if Remote:FindFirstChild("Mesh") then
  138. Remote.Mesh.MeshId = "http://www.roblox.com/asset/?id=74322546"
  139. Remote.Mesh.TextureId = "http://www.roblox.com/asset/?id=74322558"
  140. end
  141.  
  142. if Tool:FindFirstChild("TooFar") then Tool.TooFar.Value = 2 end
  143. else
  144. if Tool:FindFirstChild("TooFar") then
  145. Tool.TooFar.Value = 1
  146. end
  147. end
  148. elseif c4Clone and c4Clone.Parent then
  149. local explosion = Instance.new("Explosion")
  150. explosion.BlastRadius = 15.0
  151. explosion.BlastPressure = 9999999
  152. explosion.Position = c4Clone.Position
  153.  
  154. explosion.Hit:connect(function(hit)
  155. if hit and hit.Parent then
  156. local humanoid = hit.Parent:FindFirstChild("Humanoid")
  157. if humanoid and humanoid ~= myHumanoid then
  158. local creatorTag = Instance.new("ObjectValue")
  159. creatorTag.Name = "creator"
  160. creatorTag.Value = vPlayer
  161. creatorTag.Parent = humanoid
  162. debris:AddItem(creatorTag, 1.0)
  163. end
  164. end
  165. end)
  166.  
  167. explosion.Parent = game.Workspace
  168.  
  169. exploded = true
  170.  
  171. if Remote:FindFirstChild("Mesh") then
  172. Remote.Mesh.MeshId = "http://www.roblox.com/asset/?id=74322628"
  173. Remote.Mesh.TextureId = "http://www.roblox.com/asset/?id=74322630"
  174. end
  175.  
  176. if Tool:FindFirstChild("TooFar") then Tool.TooFar.Value = 0 end
  177. end
  178.  
  179. wait(2.0)
  180.  
  181. Tool.Enabled = true
  182. end
  183.  
  184. function onEquipped()
  185. vCharacter = Tool.Parent
  186. myTorso = vCharacter:FindFirstChild("Torso")
  187. myHumanoid = vCharacter:FindFirstChild("Humanoid")
  188. vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  189.  
  190. if (not c4Clone or not c4Clone.Parent) and Remote:FindFirstChild("Mesh") then
  191. Remote.Mesh.MeshId = "http://www.roblox.com/asset/?id=74322628"
  192. Remote.Mesh.TextureId = "http://www.roblox.com/asset/?id=74322630"
  193. end
  194. end
  195.  
  196. function onUnequipped()
  197. if Remote:FindFirstChild("Mesh") then
  198. Remote.Mesh.MeshId = "http://www.roblox.com/asset/?id=74322546"
  199. Remote.Mesh.TextureId = "http://www.roblox.com/asset/?id=74322558"
  200. end
  201. end
  202.  
  203. Tool.Activated:connect(onActivated)
  204. Tool.Equipped:connect(onEquipped)
  205. Tool.Unequipped:connect(onUnequipped)
  206.  
  207. end))
  208. LocalScript5.Name = "GuiScript"
  209. LocalScript5.Parent = Tool0
  210. table.insert(cors,sandbox(LocalScript5,function()
  211. local Tool = script.Parent
  212. local Lantern = Tool.Handle
  213.  
  214. local vCharacter
  215. local vPlayer
  216.  
  217. local sg
  218. local frame
  219. local genericTextLabel
  220.  
  221. function onEquipped()
  222. vCharacter = Tool.Parent
  223. vPlayer = game.Players:GetPlayerFromCharacter(vCharacter)
  224. if vPlayer then
  225. local playerGui = vPlayer:FindFirstChild("PlayerGui")
  226. if playerGui and playerGui:FindFirstChild("LanternGui") == nil then
  227. sg = Instance.new("ScreenGui")
  228. sg.Name = "LanternGui"
  229. sg.Parent = playerGui
  230.  
  231. frame = Instance.new("Frame")
  232. frame.Parent = sg
  233. frame.Size = UDim2.new(0, 200, 0, 30)
  234. frame.Position = UDim2.new(0.5, -100, 1, -130)
  235. frame.Style = Enum.FrameStyle.RobloxRound
  236.  
  237. genericTextLabel = Instance.new("TextLabel")
  238. genericTextLabel.BackgroundTransparency = 1.0
  239. genericTextLabel.Size = UDim2.new(1, 0, 1, 0)
  240. genericTextLabel.Visible = true
  241. genericTextLabel.ZIndex = 10
  242. genericTextLabel.FontSize = Enum.FontSize.Size10
  243. genericTextLabel.Font = Enum.Font.Legacy
  244. genericTextLabel.TextColor3 = Color3.new(1, 127/255, 0)
  245. genericTextLabel.TextXAlignment = Enum.TextXAlignment.Center
  246. genericTextLabel.TextYAlignment = Enum.TextYAlignment.Top
  247. genericTextLabel.Parent = frame
  248. genericTextLabel.Text = "Plant the bomb!"
  249. end
  250. end
  251. end
  252.  
  253. function onUnequipped()
  254. if sg then sg:Remove() end
  255. end
  256.  
  257. Tool.Equipped:connect(onEquipped)
  258. Tool.Unequipped:connect(onUnequipped)
  259.  
  260. local tooFar
  261.  
  262. while Tool:FindFirstChild("TooFar") == nil do
  263. wait()
  264. end
  265.  
  266. tooFar = Tool.TooFar
  267.  
  268. tooFar.Changed:connect(function()
  269. if tooFar and genericTextLabel then
  270. if tooFar.Value == 1 then
  271. genericTextLabel.Text = "Target too far away"
  272. wait(2.0)
  273. genericTextLabel.Text = "Plant the bomb"
  274. elseif tooFar.Value == 0 then
  275. genericTextLabel.Text = "Plant the bomb"
  276. else
  277. genericTextLabel.Text = "Time to detonate"
  278. end
  279. end
  280. end)
  281.  
  282. end))
  283. IntValue6.Name = "TooFar"
  284. IntValue6.Parent = Tool0
  285. for i,v in pairs(mas:GetChildren()) do
  286. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  287. pcall(function() v:MakeJoints() end)
  288. end
  289. mas:Destroy()
  290. for i,v in pairs(cors) do
  291. spawn(function()
  292. pcall(v)
  293. end)
  294. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement