Advertisement
Animescapetower

Trap

Mar 14th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.87 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. Sound2 = Instance.new("Sound")
  22. SpecialMesh3 = Instance.new("SpecialMesh")
  23. Script4 = Instance.new("Script")
  24. LocalScript5 = Instance.new("LocalScript")
  25. Script6 = Instance.new("Script")
  26. Configuration7 = Instance.new("Configuration")
  27. BoolValue8 = Instance.new("BoolValue")
  28. Configuration9 = Instance.new("Configuration")
  29. NumberValue10 = Instance.new("NumberValue")
  30. NumberValue11 = Instance.new("NumberValue")
  31. StringValue12 = Instance.new("StringValue")
  32. BoolValue13 = Instance.new("BoolValue")
  33. BoolValue14 = Instance.new("BoolValue")
  34. StringValue15 = Instance.new("StringValue")
  35. ObjectValue16 = Instance.new("ObjectValue")
  36. Tool0.Name = "Trap"
  37. Tool0.Parent = mas
  38. Tool0.GripForward = Vector3.new(-0, 1, -0)
  39. Tool0.GripPos = Vector3.new(0, -0.550000012, -0.649999976)
  40. Tool0.GripUp = Vector3.new(0, 0, 1)
  41. Part1.Name = "Handle"
  42. Part1.Parent = Tool0
  43. Part1.Rotation = Vector3.new(-90, 0, -90)
  44. Part1.FormFactor = Enum.FormFactor.Plate
  45. Part1.Size = Vector3.new(1, 3.60000014, 1)
  46. Part1.CFrame = CFrame.new(13.1099844, 25.6800003, 865.159973, 0, 1, 0, 0, 0, 1, 1, 0, 0)
  47. Part1.BottomSurface = Enum.SurfaceType.Smooth
  48. Part1.TopSurface = Enum.SurfaceType.Smooth
  49. Part1.Position = Vector3.new(13.1099844, 25.6800003, 865.159973)
  50. Part1.Orientation = Vector3.new(-90, -90, 0)
  51. Sound2.Name = "EquipSound"
  52. Sound2.Parent = Part1
  53. Sound2.SoundId = "http://www.roblox.com/asset/?id=10756118"
  54. SpecialMesh3.Parent = Part1
  55. SpecialMesh3.MeshId = "http://www.roblox.com/asset/?id=11915746"
  56. SpecialMesh3.TextureId = "http://www.roblox.com/asset/?id=87812844"
  57. SpecialMesh3.MeshType = Enum.MeshType.FileMesh
  58. Script4.Name = "RayGun"
  59. Script4.Parent = Tool0
  60. table.insert(cors,sandbox(Script4,function()
  61. local Tool = script.Parent;
  62.  
  63. enabled = true
  64.  
  65. local spark = Instance.new("Sparkles")
  66.  
  67. function fire(v)
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77. local vCharacter = Tool.Parent
  78. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  79.  
  80. local missile = Instance.new("Part")
  81.  
  82. local spawnPos = vCharacter.PrimaryPart.Position
  83.  
  84. local PewPew = Tool.Handle:FindFirstChild("PewPew")
  85.  
  86. if (PewPew == nil) then
  87. PewPew = Instance.new("Sound")
  88. PewPew.Name = "PewPew"
  89. PewPew.SoundId = "http://www.roblox.com/asset/?id=11944350"
  90. PewPew.Parent = Tool.Handle
  91. PewPew.Volume = 1
  92. end
  93.  
  94.  
  95. spawnPos = spawnPos + (v * 10)
  96.  
  97.  
  98. missile.Position = spawnPos
  99. missile.Size = Vector3.new(40,40,40)
  100. missile.Velocity = v * 200
  101. missile.BrickColor = BrickColor.new("Lime green")
  102. missile.Shape = 2
  103. missile.Transparency = script.Parent.Settings.Transperancy.Value
  104. missile.BottomSurface = 0
  105. missile.TopSurface = 0
  106. missile.Name = script.Parent.Settings.Name
  107. missile.Reflectance = script.Parent.Settings.Reflect.Value
  108. missile.CanCollide = script.Parent.Settings.Collide.Value
  109. missile.Material = script.Parent.Settings.Materializer.Value
  110. missile.Locked = script.Parent.Settings.Locked.Value
  111. missile.Anchored = script.Parent.BreakSpark.Anchor.Value
  112.  
  113.  
  114. spark:Clone().Parent = missile
  115. spark.Color = missile.Color
  116.  
  117.  
  118. local force = Instance.new("BodyForce")
  119. force.force = Vector3.new(0,100,0)
  120. force.Parent = missile
  121.  
  122. local creator_tag = Instance.new("ObjectValue")
  123. creator_tag.Value = vPlayer
  124. creator_tag.Name = "creator"
  125. creator_tag.Parent = missile
  126.  
  127. local new_script = script.Parent.LaserBlast:clone()
  128. new_script.Disabled = false
  129. new_script.Parent = missile
  130.  
  131. missile.Parent = game.Workspace
  132.  
  133. PewPew:Play()
  134.  
  135. end
  136.  
  137.  
  138.  
  139. function gunUp()
  140. Tool.GripForward = Vector3.new(0,.981,-.196)
  141. Tool.GripRight = Vector3.new(1,0,0)
  142. Tool.GripUp = Vector3.new(0,.196,.981)
  143. end
  144.  
  145. function gunOut()
  146. Tool.GripForward = Vector3.new(0,1,0)
  147. Tool.GripRight = Vector3.new(1,0,0)
  148. Tool.GripUp = Vector3.new(0,0,1)
  149. end
  150.  
  151. function isTurbo(character)
  152. return character:FindFirstChild("BoltHelm") ~= nil
  153. end
  154.  
  155.  
  156. function onActivated()
  157. if not enabled then
  158. return
  159. end
  160.  
  161. enabled = false
  162.  
  163.  
  164. local character = Tool.Parent;
  165. local humanoid = character.Humanoid
  166. if humanoid == nil then
  167. print("Humanoid not found")
  168. return
  169. end
  170.  
  171. local targetPos = humanoid.TargetPoint
  172. local lookAt = (targetPos - character.Head.Position).unit
  173.  
  174. local reload = 1
  175. --if (isTurbo(character)) then
  176. -- reload = .25
  177. -- print("turbo")
  178. --end
  179.  
  180. gunUp()
  181. fire(lookAt)
  182. wait(reload)
  183. gunOut()
  184. wait(reload)
  185.  
  186. enabled = true
  187.  
  188. end
  189.  
  190. function onEquipped()
  191. Tool.Handle.EquipSound:play()
  192. end
  193.  
  194. script.Parent.Activated:connect(onActivated)
  195. script.Parent.Equipped:connect(onEquipped)
  196.  
  197. end))
  198. LocalScript5.Name = "Local Gui"
  199. LocalScript5.Parent = Tool0
  200. table.insert(cors,sandbox(LocalScript5,function()
  201. local Tool = script.Parent;
  202.  
  203. enabled = true
  204. function onButton1Down(mouse)
  205. if not enabled then
  206. return
  207. end
  208.  
  209. enabled = false
  210. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  211.  
  212. wait(1)
  213. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  214. enabled = true
  215.  
  216. end
  217.  
  218. function onEquippedLocal(mouse)
  219.  
  220. if mouse == nil then
  221. print("Mouse not found")
  222. return
  223. end
  224.  
  225. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  226. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  227. end
  228.  
  229.  
  230. Tool.Equipped:connect(onEquippedLocal)
  231.  
  232. end))
  233. Script6.Name = "LaserBlast"
  234. Script6.Parent = Tool0
  235. Script6.Disabled = true
  236. table.insert(cors,sandbox(Script6,function()
  237. ball = script.Parent
  238. damage = 9000
  239.  
  240. HitSound = Instance.new("Sound")
  241. HitSound.Name = "HitSound"
  242. HitSound.SoundId = "http://www.roblox.com/asset/?id=11945266"
  243. HitSound.Parent = ball
  244. HitSound.Volume = 1
  245.  
  246.  
  247.  
  248. function onTouched(hit)
  249. local humanoid = hit.Parent:findFirstChild("Humanoid")
  250.  
  251. if humanoid ~= nil then
  252. tagHumanoid(humanoid)
  253. humanoid:TakeDamage(damage)
  254. plyr = ball:findFirstChild("creator").Value
  255. plyr.leaderstats.Points.Value = plyr.leaderstats.Points.Value + 4
  256. wait(0.2)
  257. untagHumanoid(humanoid)
  258. end
  259.  
  260. HitSound:Play()
  261. ball.Parent = nil
  262.  
  263. end
  264.  
  265. function tagHumanoid(humanoid)
  266. -- todo: make tag expire
  267. local tag = ball:findFirstChild("creator")
  268. if tag ~= nil then
  269. local new_tag = tag:clone()
  270. new_tag.Parent = humanoid
  271. end
  272. end
  273.  
  274.  
  275. function untagHumanoid(humanoid)
  276. if humanoid ~= nil then
  277. local tag = humanoid:findFirstChild("creator")
  278. if tag ~= nil then
  279. tag.Parent = nil
  280. end
  281. end
  282. end
  283.  
  284. connection = ball.Touched:connect(onTouched)
  285.  
  286. wait(5)
  287. script.Parent:Destroy()
  288.  
  289. --ball.SparkSound.Looped = false
  290. --ball.SparkSound:Stop()
  291. ball.Parent = nil
  292. end))
  293. Configuration7.Name = "BreakSpark"
  294. Configuration7.Parent = Tool0
  295. BoolValue8.Name = "Anchor"
  296. BoolValue8.Parent = Configuration7
  297. BoolValue8.Value = true
  298. Configuration9.Name = "Settings"
  299. Configuration9.Parent = Tool0
  300. NumberValue10.Name = "Transperancy"
  301. NumberValue10.Parent = Configuration9
  302. NumberValue10.Value = 0.5
  303. NumberValue11.Name = "Reflect"
  304. NumberValue11.Parent = Configuration9
  305. NumberValue11.Value = 0.4
  306. StringValue12.Name = "Name"
  307. StringValue12.Parent = Configuration9
  308. StringValue12.Value = "NAY"
  309. BoolValue13.Name = "Locked"
  310. BoolValue13.Parent = Configuration9
  311. BoolValue13.Value = true
  312. BoolValue14.Name = "Collide"
  313. BoolValue14.Parent = Configuration9
  314. BoolValue14.Value = true
  315. StringValue15.Name = "Materializer"
  316. StringValue15.Parent = Configuration9
  317. StringValue15.Value = "Neon"
  318. ObjectValue16.Name = "Note - This is made by Anime"
  319. ObjectValue16.Parent = Tool0
  320. for i,v in pairs(mas:GetChildren()) do
  321. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  322. pcall(function() v:MakeJoints() end)
  323. end
  324. mas:Destroy()
  325. for i,v in pairs(cors) do
  326. spawn(function()
  327. pcall(v)
  328. end)
  329. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement