lafur

Untitled

Jun 16th, 2020
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. Tool0 = Instance.new("Tool")
  19. Part1 = Instance.new("Part")
  20. SpecialMesh2 = Instance.new("SpecialMesh")
  21. Sound3 = Instance.new("Sound")
  22. Sound4 = Instance.new("Sound")
  23. IntValue5 = Instance.new("IntValue")
  24. LocalScript6 = Instance.new("LocalScript")
  25. Animation7 = Instance.new("Animation")
  26. Animation8 = Instance.new("Animation")
  27. Animation9 = Instance.new("Animation")
  28. ScreenGui10 = Instance.new("ScreenGui")
  29. ImageLabel11 = Instance.new("ImageLabel")
  30. Frame12 = Instance.new("Frame")
  31. Frame13 = Instance.new("Frame")
  32. Frame14 = Instance.new("Frame")
  33. Frame15 = Instance.new("Frame")
  34. Frame16 = Instance.new("Frame")
  35. Frame17 = Instance.new("Frame")
  36. Frame18 = Instance.new("Frame")
  37. Sound19 = Instance.new("Sound")
  38. Sound20 = Instance.new("Sound")
  39. BoolValue21 = Instance.new("BoolValue")
  40. Tool0.Name = "Sniper"
  41. Tool0.Parent = mas
  42. Tool0.TextureId = "http://www.roblox.com/asset/?id=72013006"
  43. Tool0.GripForward = Vector3.new(-0.433848739, 0.867697477, 0.242644712)
  44. Tool0.GripPos = Vector3.new(0.125, -1, -0.5)
  45. Tool0.GripRight = Vector3.new(0.89442718, 0.44721359, 0)
  46. Tool0.GripUp = Vector3.new(0.108513996, -0.217027992, 0.970115185)
  47. Tool0.ToolTip = "Sniper: Press E to use scope."
  48. Part1.Name = "Handle"
  49. Part1.Parent = Tool0
  50. Part1.BrickColor = BrickColor.new("Pastel yellow")
  51. Part1.FormFactor = Enum.FormFactor.Symmetric
  52. Part1.Size = Vector3.new(1, 4, 1)
  53. Part1.CFrame = CFrame.new(-9.45001221, 2, 3.62001061, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  54. Part1.Color = Color3.new(1, 1, 0.8)
  55. Part1.Position = Vector3.new(-9.45001221, 2, 3.62001061)
  56. Part1.Color = Color3.new(1, 1, 0.8)
  57. SpecialMesh2.Parent = Part1
  58. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=72012972"
  59. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  60. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=72012935"
  61. SpecialMesh2.VertexColor = Vector3.new(2, 2, 2)
  62. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  63. SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
  64. Sound3.Name = "Fire"
  65. Sound3.Parent = Part1
  66. Sound3.SoundId = "rbxassetid://10209875"
  67. Sound3.Volume = 1
  68. Sound4.Name = "Reload"
  69. Sound4.Parent = Part1
  70. Sound4.SoundId = "rbxassetid://2761842"
  71. Sound4.Volume = 1
  72. IntValue5.Name = "Ammo"
  73. IntValue5.Parent = Tool0
  74. LocalScript6.Parent = Tool0
  75. table.insert(cors,sandbox(LocalScript6,function()
  76. --Made by Stickmasterluke
  77.  
  78.  
  79. sp=script.Parent
  80.  
  81.  
  82. firerate=1.5
  83. range=950
  84. power=300
  85. rate=1/30
  86. spinuptime=0
  87. barreloffset=Vector3.new(0,2.75,.375)
  88. windvec=Vector3.new(2,-1,1).unit
  89. firetime=0
  90. maxammo=5
  91. reloadtime = 5
  92. ammo=maxammo
  93.  
  94. debris=game:GetService("Debris")
  95. equipped=false
  96. check=true
  97. firing=false
  98. reloading=false
  99.  
  100. function wait(TimeToWait)
  101. if TimeToWait ~= nil then
  102. local TotalTime = 0
  103. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  104. while TotalTime < TimeToWait do
  105. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  106. end
  107. else
  108. game:GetService("RunService").Heartbeat:wait()
  109. end
  110. end
  111.  
  112. function waitfor(parent,name)
  113. while parent:FindFirstChild(name)==nil do
  114. wait()
  115. end
  116. return parent:FindFirstChild(name)
  117. end
  118.  
  119. function checkintangible(hit)
  120. if hit and hit~=nil then
  121. if hit:IsDescendantOf(sp.Parent) or hit.Transparency>.8 or hit.Name=="Handle" or hit.Name=="Effect" or hit.Name=="Bullet" or hit.Name=="Laser" or string.lower(hit.Name)=="water" or hit.Name=="Rail" or hit.Name=="Arrow" then
  122. return true
  123. end
  124. end
  125. return false
  126. end
  127.  
  128. function castray(startpos,vec,length,ignore,delayifhit)
  129. local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
  130. if hit~=nil then
  131. if checkintangible(hit) then
  132. if delayifhit then
  133. wait()
  134. end
  135. hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
  136. end
  137. end
  138. return hit,endpos2
  139. end
  140.  
  141. function wait(TimeToWait)
  142. if TimeToWait ~= nil then
  143. local TotalTime = 0
  144. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  145. while TotalTime < TimeToWait do
  146. TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
  147. end
  148. else
  149. game:GetService("RunService").Heartbeat:wait()
  150. end
  151. end
  152.  
  153. function drawbeam(beamstart,beamend,clr,fadedelay)
  154. local dist=(beamstart-beamend).magnitude
  155. local laser=Instance.new("Part")
  156. laser.Name="Effect"
  157. laser.Anchored=true
  158. laser.CanCollide=false
  159. laser.Shape="Block"
  160. laser.formFactor="Custom"
  161. laser.Size=Vector3.new(.2,.2,.2)
  162. laser.Transparency=0
  163. laser.Material=Enum.Material.Plastic
  164. laser.Locked=true
  165. laser.TopSurface=0
  166. laser.BottomSurface=0
  167. laser.BrickColor=clr
  168. laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
  169. local m=Instance.new("SpecialMesh")
  170. m.Scale=Vector3.new(1,dist*5,1)
  171. m.MeshType="Brick"
  172. m.Parent=laser
  173. debris:AddItem(laser,fadedelay*0.5)
  174. laser.Parent=game.Workspace
  175.  
  176. --[[local frames=math.floor(fadedelay/rate)
  177. for frame=1,frames do
  178. wait(rate)
  179. local percent=frame/frames
  180. laser.CFrame=laser.CFrame+windvec*rate
  181. laser.Transparency=.5+(percent*.5)
  182. end]]
  183. wait(.5)
  184. laser:remove()
  185. end
  186.  
  187. function fire()
  188. local hu=sp.Parent:FindFirstChild("Humanoid")
  189. local he=sp.Parent:FindFirstChild("Head")
  190. local t=sp.Parent:FindFirstChild("Torso")
  191. if hu and hu.Health>0 and t and he and themouse~=nil and equipped then
  192.  
  193. anim2 = sp.Parent.Humanoid:LoadAnimation(sp.FireAni)
  194. if anim2 then anim2:Play() anim2:AdjustSpeed(1.75) end
  195. local startpos=he.Position
  196. local fakestartpos=(sp.Handle.CFrame*CFrame.new(barreloffset)).p
  197. local vec=(themouse.Hit.p-startpos).unit + (Vector3.new(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)) / (1500*1500))
  198.  
  199. local p=Instance.new("Part")
  200. p.Name="Effect"
  201. p.BrickColor=BrickColor.new("Black")
  202. p.CanCollide=false
  203. p.TopSurface="Smooth"
  204. p.BottomSurface="Smooth"
  205. p.formFactor="Custom"
  206. p.Size=Vector3.new(0,0,0)
  207. p.Transparency=1
  208. local m=Instance.new("SpecialMesh")
  209. m.Parent=p
  210.  
  211. local hit,endpos=castray(startpos,vec,range,sp.Parent,false)
  212. local fakevec=(endpos-fakestartpos).unit
  213. if hit~=nil then
  214. local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,0,0)
  215. p.CFrame=newcf
  216. local w=Instance.new("Weld")
  217. w.Part0=hit
  218. w.Part1=p
  219. w.C0=hit.CFrame:inverse()*newcf
  220. w.C1=newcf:inverse()*newcf
  221. w.Parent=p
  222.  
  223. local c=Instance.new("ObjectValue")
  224. c.Name="creator"
  225. c.Value=owner
  226. c.Parent=p
  227.  
  228. local Humanoid = hit.Parent:FindFirstChild("Humanoid")
  229. local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
  230. if Humanoid ~= nil then hit.Parent.Humanoid:TakeDamage(250)
  231. if Humanoid and Humanoid.Health <= 200 and hit.Name == "Head" and Player then sp["HeadshotPlayer"..math.random(1,2)]:Play() end
  232. else
  233. p.CFrame=CFrame.new(endpos,endpos+fakevec)
  234. p.Velocity=fakevec*power
  235. p.Parent=game.Workspace
  236. end
  237.  
  238.  
  239. debris:AddItem(p,1)
  240. p.Parent=game.Workspace
  241.  
  242. delay(0,function()
  243. drawbeam(fakestartpos,endpos,BrickColor.new("Bright yellow"),.1)
  244. end)
  245.  
  246. local sound=sp.Handle:FindFirstChild("Fire")
  247. if sound~=nil then
  248. --sound:Stop()
  249. sound:Play()
  250. end
  251.  
  252. local shoulder=t:FindFirstChild("Right Shoulder")
  253. if shoulder~=nil then
  254. shoulder.CurrentAngle=(math.pi/2)+.1
  255. end
  256. end
  257. end
  258. end
  259.  
  260. function onEquipped(mouse)
  261. equipped=true
  262. if mouse~=nil then
  263. anim = sp.Parent.Humanoid:LoadAnimation(sp.idle)
  264. if anim then anim:Play() end
  265. themouse=mouse
  266. mouse.Icon="http://www.roblox.com/asset/?id=2966012"
  267. mouse.Button1Down:connect(function()
  268. if sp.Enabled == false then return end
  269. sp.Enabled = false
  270. if ammo > 0 then
  271. ammo = ammo - 1
  272. fire()
  273. else
  274. Reload()
  275. end
  276. --mouse.Icon="http://www.roblox.com/asset/?id=2966012"
  277. Delay(firerate,function() if ammo == 0 then Reload() end sp.Enabled = true end)
  278. end)
  279. mouse.Button1Up:connect(function()
  280. --mouse.Icon="http://www.roblox.com/asset/?id=2966012"
  281. end)
  282. mouse.KeyDown:connect(function(Key)
  283. if string.lower(Key) == "r" then
  284. if ammo ~= maxammo and sp.Enabled == true then sp.Enabled = false Reload() sp.Enabled = true end
  285. elseif string.lower(Key) == "e" then
  286. if sp.AimDown.Value == false then
  287. Workspace.CurrentCamera.FieldOfView = 12.5
  288. local GUI = owner.PlayerGui:FindFirstChild("ZoomGui") or sp.ZoomGui:Clone()
  289. GUI.Parent = owner.PlayerGui
  290. owner.CameraMode = Enum.CameraMode.LockFirstPerson
  291. sp.AimDown.Value = true
  292. mouse.Icon="http://www.roblox.com/asset?id=187746799"
  293. else
  294. Workspace.CurrentCamera.FieldOfView = 70
  295. local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
  296. if GUI then GUI:Destroy() end
  297. owner.CameraMode = Enum.CameraMode.Classic
  298. sp.AimDown.Value = false
  299. mouse.Icon="http://www.roblox.com/asset/?id=2966012"
  300. end
  301. end
  302. end)
  303. end
  304. end
  305.  
  306. function Reload()
  307. anim3 = sp.Parent.Humanoid:LoadAnimation(sp.Reload)
  308. if anim3 then anim3:Play() anim3:AdjustSpeed(2.5) end
  309. local sound=sp.Handle:FindFirstChild("Reload")
  310. if sound~=nil then
  311. sound:Play()
  312. end
  313. wait(reloadtime)
  314. ammo = maxammo
  315. end
  316.  
  317. function onUnequipped()
  318. if anim then anim:Stop() end
  319. equipped=false
  320. themouse=nil
  321. if sp.AimDown.Value == true then
  322. Workspace.CurrentCamera.FieldOfView = 70
  323. local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
  324. if GUI then GUI:Destroy() end
  325. owner.CameraMode = Enum.CameraMode.Classic
  326. sp.AimDown.Value = false
  327. end
  328. end
  329.  
  330. sp.Equipped:connect(onEquipped)
  331. sp.Unequipped:connect(onUnequipped)
  332.  
  333. end))
  334. Animation7.Name = "FireAni"
  335. Animation7.Parent = Tool0
  336. Animation7.AnimationId = "http://www.roblox.com/Asset?ID=94332152"
  337. Animation8.Name = "Reload"
  338. Animation8.Parent = Tool0
  339. Animation8.AnimationId = "http://www.roblox.com/Asset?ID=94332664"
  340. Animation9.Name = "idle"
  341. Animation9.Parent = Tool0
  342. Animation9.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
  343. ScreenGui10.Name = "ZoomGui"
  344. ScreenGui10.Parent = Tool0
  345. ImageLabel11.Name = "Scope"
  346. ImageLabel11.Parent = ScreenGui10
  347. ImageLabel11.Transparency = 1
  348. ImageLabel11.Size = UDim2.new(0, 750, 0, 750)
  349. ImageLabel11.Position = UDim2.new(0.5, -375, 0.5, -390)
  350. ImageLabel11.BackgroundColor3 = Color3.new(0, 0, 0)
  351. ImageLabel11.BackgroundTransparency = 1
  352. ImageLabel11.BorderColor3 = Color3.new(0, 0, 0)
  353. ImageLabel11.Image = "http://www.roblox.com/asset/?id=72002022"
  354. ImageLabel11.ImageColor3 = Color3.new(255, 255, 255)
  355. Frame12.Parent = ImageLabel11
  356. Frame12.Size = UDim2.new(0, 750, 0, 500)
  357. Frame12.Position = UDim2.new(0, 0, 0, -450)
  358. Frame12.BackgroundColor3 = Color3.new(0, 0, 0)
  359. Frame12.BorderColor3 = Color3.new(0, 0, 0)
  360. Frame13.Parent = ImageLabel11
  361. Frame13.Size = UDim2.new(0, 750, 0, 500)
  362. Frame13.Position = UDim2.new(0, 0, 1, -50)
  363. Frame13.BackgroundColor3 = Color3.new(0, 0, 0)
  364. Frame13.BorderColor3 = Color3.new(0, 0, 0)
  365. Frame14.Parent = ImageLabel11
  366. Frame14.Size = UDim2.new(0, 500, 1, 100)
  367. Frame14.Position = UDim2.new(1, -50, 0, -50)
  368. Frame14.BackgroundColor3 = Color3.new(0, 0, 0)
  369. Frame14.BorderColor3 = Color3.new(0, 0, 0)
  370. Frame15.Parent = ImageLabel11
  371. Frame15.Size = UDim2.new(0, 500, 1, 100)
  372. Frame15.Position = UDim2.new(0, -450, 0, -50)
  373. Frame15.BackgroundColor3 = Color3.new(0, 0, 0)
  374. Frame15.BorderColor3 = Color3.new(0, 0, 0)
  375. Frame16.Name = "Crosshair"
  376. Frame16.Parent = ScreenGui10
  377. Frame16.Size = UDim2.new(1, 0, 0, 2)
  378. Frame16.Position = UDim2.new(0, 0, 0.5, -16)
  379. Frame16.BackgroundColor3 = Color3.new(0, 0, 0)
  380. Frame16.BorderColor3 = Color3.new(0, 0, 0)
  381. Frame16.BorderSizePixel = 0
  382. Frame17.Name = "Crosshair"
  383. Frame17.Parent = ScreenGui10
  384. Frame17.Size = UDim2.new(0, 2, 1, 0)
  385. Frame17.Position = UDim2.new(0.5, -1, 0, 0)
  386. Frame17.BackgroundColor3 = Color3.new(0, 0, 0)
  387. Frame17.BorderColor3 = Color3.new(0, 0, 0)
  388. Frame17.BorderSizePixel = 0
  389. Frame18.Name = "Crosshair"
  390. Frame18.Parent = ScreenGui10
  391. Frame18.Size = UDim2.new(0, 2, 0, 2)
  392. Frame18.Position = UDim2.new(0.5, -1, 0.5, -16)
  393. Frame18.BackgroundColor3 = Color3.new(1, 0, 0)
  394. Frame18.BorderColor3 = Color3.new(0, 0, 0)
  395. Frame18.BorderSizePixel = 0
  396. Sound19.Name = "HeadshotPlayer1"
  397. Sound19.Parent = Tool0
  398. Sound19.SoundId = "rbxassetid://178070151"
  399. Sound19.Volume = 1
  400. Sound20.Name = "HeadshotPlayer2"
  401. Sound20.Parent = Tool0
  402. Sound20.SoundId = "rbxassetid://178072179"
  403. Sound20.Volume = 1
  404. BoolValue21.Name = "AimDown"
  405. BoolValue21.Parent = Tool0
  406. for i,v in pairs(mas:GetChildren()) do
  407. v.Parent = owner.Backpack
  408. pcall(function() v:MakeJoints() end)
  409. end
  410. mas:Destroy()
  411. for i,v in pairs(cors) do
  412. spawn(function()
  413. pcall(v)
  414. end)
  415. end
Add Comment
Please, Sign In to add comment