Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Tool0 = Instance.new("Tool")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Sound3 = Instance.new("Sound")
- Sound4 = Instance.new("Sound")
- IntValue5 = Instance.new("IntValue")
- LocalScript6 = Instance.new("LocalScript")
- Animation7 = Instance.new("Animation")
- Animation8 = Instance.new("Animation")
- Animation9 = Instance.new("Animation")
- ScreenGui10 = Instance.new("ScreenGui")
- ImageLabel11 = Instance.new("ImageLabel")
- Frame12 = Instance.new("Frame")
- Frame13 = Instance.new("Frame")
- Frame14 = Instance.new("Frame")
- Frame15 = Instance.new("Frame")
- Frame16 = Instance.new("Frame")
- Frame17 = Instance.new("Frame")
- Frame18 = Instance.new("Frame")
- Sound19 = Instance.new("Sound")
- Sound20 = Instance.new("Sound")
- BoolValue21 = Instance.new("BoolValue")
- Tool0.Name = "Sniper"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=72013006"
- Tool0.GripForward = Vector3.new(-0.433848739, 0.867697477, 0.242644712)
- Tool0.GripPos = Vector3.new(0.125, -1, -0.5)
- Tool0.GripRight = Vector3.new(0.89442718, 0.44721359, 0)
- Tool0.GripUp = Vector3.new(0.108513996, -0.217027992, 0.970115185)
- Tool0.ToolTip = "Sniper: Press E to use scope."
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Pastel yellow")
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(1, 4, 1)
- Part1.CFrame = CFrame.new(-9.45001221, 2, 3.62001061, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Color = Color3.new(1, 1, 0.8)
- Part1.Position = Vector3.new(-9.45001221, 2, 3.62001061)
- Part1.Color = Color3.new(1, 1, 0.8)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=72012972"
- SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=72012935"
- SpecialMesh2.VertexColor = Vector3.new(2, 2, 2)
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- SpecialMesh2.Scale = Vector3.new(1.5, 1.5, 1.5)
- Sound3.Name = "Fire"
- Sound3.Parent = Part1
- Sound3.SoundId = "rbxassetid://10209875"
- Sound3.Volume = 1
- Sound4.Name = "Reload"
- Sound4.Parent = Part1
- Sound4.SoundId = "rbxassetid://2761842"
- Sound4.Volume = 1
- IntValue5.Name = "Ammo"
- IntValue5.Parent = Tool0
- LocalScript6.Parent = Tool0
- table.insert(cors,sandbox(LocalScript6,function()
- --Made by Stickmasterluke
- sp=script.Parent
- firerate=1.5
- range=950
- power=300
- rate=1/30
- spinuptime=0
- barreloffset=Vector3.new(0,2.75,.375)
- windvec=Vector3.new(2,-1,1).unit
- firetime=0
- maxammo=5
- reloadtime = 5
- ammo=maxammo
- debris=game:GetService("Debris")
- equipped=false
- check=true
- firing=false
- reloading=false
- function wait(TimeToWait)
- if TimeToWait ~= nil then
- local TotalTime = 0
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- while TotalTime < TimeToWait do
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- end
- else
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- function waitfor(parent,name)
- while parent:FindFirstChild(name)==nil do
- wait()
- end
- return parent:FindFirstChild(name)
- end
- function checkintangible(hit)
- if hit and hit~=nil then
- 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
- return true
- end
- end
- return false
- end
- function castray(startpos,vec,length,ignore,delayifhit)
- local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore)
- if hit~=nil then
- if checkintangible(hit) then
- if delayifhit then
- wait()
- end
- hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit)
- end
- end
- return hit,endpos2
- end
- function wait(TimeToWait)
- if TimeToWait ~= nil then
- local TotalTime = 0
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- while TotalTime < TimeToWait do
- TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
- end
- else
- game:GetService("RunService").Heartbeat:wait()
- end
- end
- function drawbeam(beamstart,beamend,clr,fadedelay)
- local dist=(beamstart-beamend).magnitude
- local laser=Instance.new("Part")
- laser.Name="Effect"
- laser.Anchored=true
- laser.CanCollide=false
- laser.Shape="Block"
- laser.formFactor="Custom"
- laser.Size=Vector3.new(.2,.2,.2)
- laser.Transparency=0
- laser.Material=Enum.Material.Plastic
- laser.Locked=true
- laser.TopSurface=0
- laser.BottomSurface=0
- laser.BrickColor=clr
- laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0)
- local m=Instance.new("SpecialMesh")
- m.Scale=Vector3.new(1,dist*5,1)
- m.MeshType="Brick"
- m.Parent=laser
- debris:AddItem(laser,fadedelay*0.5)
- laser.Parent=game.Workspace
- --[[local frames=math.floor(fadedelay/rate)
- for frame=1,frames do
- wait(rate)
- local percent=frame/frames
- laser.CFrame=laser.CFrame+windvec*rate
- laser.Transparency=.5+(percent*.5)
- end]]
- wait(.5)
- laser:remove()
- end
- function fire()
- local hu=sp.Parent:FindFirstChild("Humanoid")
- local he=sp.Parent:FindFirstChild("Head")
- local t=sp.Parent:FindFirstChild("Torso")
- if hu and hu.Health>0 and t and he and themouse~=nil and equipped then
- anim2 = sp.Parent.Humanoid:LoadAnimation(sp.FireAni)
- if anim2 then anim2:Play() anim2:AdjustSpeed(1.75) end
- local startpos=he.Position
- local fakestartpos=(sp.Handle.CFrame*CFrame.new(barreloffset)).p
- local vec=(themouse.Hit.p-startpos).unit + (Vector3.new(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)) / (1500*1500))
- local p=Instance.new("Part")
- p.Name="Effect"
- p.BrickColor=BrickColor.new("Black")
- p.CanCollide=false
- p.TopSurface="Smooth"
- p.BottomSurface="Smooth"
- p.formFactor="Custom"
- p.Size=Vector3.new(0,0,0)
- p.Transparency=1
- local m=Instance.new("SpecialMesh")
- m.Parent=p
- local hit,endpos=castray(startpos,vec,range,sp.Parent,false)
- local fakevec=(endpos-fakestartpos).unit
- if hit~=nil then
- local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,0,0)
- p.CFrame=newcf
- local w=Instance.new("Weld")
- w.Part0=hit
- w.Part1=p
- w.C0=hit.CFrame:inverse()*newcf
- w.C1=newcf:inverse()*newcf
- w.Parent=p
- local c=Instance.new("ObjectValue")
- c.Name="creator"
- c.Value=owner
- c.Parent=p
- local Humanoid = hit.Parent:FindFirstChild("Humanoid")
- local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
- if Humanoid ~= nil then hit.Parent.Humanoid:TakeDamage(250)
- if Humanoid and Humanoid.Health <= 200 and hit.Name == "Head" and Player then sp["HeadshotPlayer"..math.random(1,2)]:Play() end
- else
- p.CFrame=CFrame.new(endpos,endpos+fakevec)
- p.Velocity=fakevec*power
- p.Parent=game.Workspace
- end
- debris:AddItem(p,1)
- p.Parent=game.Workspace
- delay(0,function()
- drawbeam(fakestartpos,endpos,BrickColor.new("Bright yellow"),.1)
- end)
- local sound=sp.Handle:FindFirstChild("Fire")
- if sound~=nil then
- --sound:Stop()
- sound:Play()
- end
- local shoulder=t:FindFirstChild("Right Shoulder")
- if shoulder~=nil then
- shoulder.CurrentAngle=(math.pi/2)+.1
- end
- end
- end
- end
- function onEquipped(mouse)
- equipped=true
- if mouse~=nil then
- anim = sp.Parent.Humanoid:LoadAnimation(sp.idle)
- if anim then anim:Play() end
- themouse=mouse
- mouse.Icon="http://www.roblox.com/asset/?id=2966012"
- mouse.Button1Down:connect(function()
- if sp.Enabled == false then return end
- sp.Enabled = false
- if ammo > 0 then
- ammo = ammo - 1
- fire()
- else
- Reload()
- end
- --mouse.Icon="http://www.roblox.com/asset/?id=2966012"
- Delay(firerate,function() if ammo == 0 then Reload() end sp.Enabled = true end)
- end)
- mouse.Button1Up:connect(function()
- --mouse.Icon="http://www.roblox.com/asset/?id=2966012"
- end)
- mouse.KeyDown:connect(function(Key)
- if string.lower(Key) == "r" then
- if ammo ~= maxammo and sp.Enabled == true then sp.Enabled = false Reload() sp.Enabled = true end
- elseif string.lower(Key) == "e" then
- if sp.AimDown.Value == false then
- Workspace.CurrentCamera.FieldOfView = 12.5
- local GUI = owner.PlayerGui:FindFirstChild("ZoomGui") or sp.ZoomGui:Clone()
- GUI.Parent = owner.PlayerGui
- owner.CameraMode = Enum.CameraMode.LockFirstPerson
- sp.AimDown.Value = true
- mouse.Icon="http://www.roblox.com/asset?id=187746799"
- else
- Workspace.CurrentCamera.FieldOfView = 70
- local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
- if GUI then GUI:Destroy() end
- owner.CameraMode = Enum.CameraMode.Classic
- sp.AimDown.Value = false
- mouse.Icon="http://www.roblox.com/asset/?id=2966012"
- end
- end
- end)
- end
- end
- function Reload()
- anim3 = sp.Parent.Humanoid:LoadAnimation(sp.Reload)
- if anim3 then anim3:Play() anim3:AdjustSpeed(2.5) end
- local sound=sp.Handle:FindFirstChild("Reload")
- if sound~=nil then
- sound:Play()
- end
- wait(reloadtime)
- ammo = maxammo
- end
- function onUnequipped()
- if anim then anim:Stop() end
- equipped=false
- themouse=nil
- if sp.AimDown.Value == true then
- Workspace.CurrentCamera.FieldOfView = 70
- local GUI = owner.PlayerGui:FindFirstChild("ZoomGui")
- if GUI then GUI:Destroy() end
- owner.CameraMode = Enum.CameraMode.Classic
- sp.AimDown.Value = false
- end
- end
- sp.Equipped:connect(onEquipped)
- sp.Unequipped:connect(onUnequipped)
- end))
- Animation7.Name = "FireAni"
- Animation7.Parent = Tool0
- Animation7.AnimationId = "http://www.roblox.com/Asset?ID=94332152"
- Animation8.Name = "Reload"
- Animation8.Parent = Tool0
- Animation8.AnimationId = "http://www.roblox.com/Asset?ID=94332664"
- Animation9.Name = "idle"
- Animation9.Parent = Tool0
- Animation9.AnimationId = "http://www.roblox.com/Asset?ID=94331086"
- ScreenGui10.Name = "ZoomGui"
- ScreenGui10.Parent = Tool0
- ImageLabel11.Name = "Scope"
- ImageLabel11.Parent = ScreenGui10
- ImageLabel11.Transparency = 1
- ImageLabel11.Size = UDim2.new(0, 750, 0, 750)
- ImageLabel11.Position = UDim2.new(0.5, -375, 0.5, -390)
- ImageLabel11.BackgroundColor3 = Color3.new(0, 0, 0)
- ImageLabel11.BackgroundTransparency = 1
- ImageLabel11.BorderColor3 = Color3.new(0, 0, 0)
- ImageLabel11.Image = "http://www.roblox.com/asset/?id=72002022"
- ImageLabel11.ImageColor3 = Color3.new(255, 255, 255)
- Frame12.Parent = ImageLabel11
- Frame12.Size = UDim2.new(0, 750, 0, 500)
- Frame12.Position = UDim2.new(0, 0, 0, -450)
- Frame12.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame12.BorderColor3 = Color3.new(0, 0, 0)
- Frame13.Parent = ImageLabel11
- Frame13.Size = UDim2.new(0, 750, 0, 500)
- Frame13.Position = UDim2.new(0, 0, 1, -50)
- Frame13.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame13.BorderColor3 = Color3.new(0, 0, 0)
- Frame14.Parent = ImageLabel11
- Frame14.Size = UDim2.new(0, 500, 1, 100)
- Frame14.Position = UDim2.new(1, -50, 0, -50)
- Frame14.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame14.BorderColor3 = Color3.new(0, 0, 0)
- Frame15.Parent = ImageLabel11
- Frame15.Size = UDim2.new(0, 500, 1, 100)
- Frame15.Position = UDim2.new(0, -450, 0, -50)
- Frame15.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame15.BorderColor3 = Color3.new(0, 0, 0)
- Frame16.Name = "Crosshair"
- Frame16.Parent = ScreenGui10
- Frame16.Size = UDim2.new(1, 0, 0, 2)
- Frame16.Position = UDim2.new(0, 0, 0.5, -16)
- Frame16.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame16.BorderColor3 = Color3.new(0, 0, 0)
- Frame16.BorderSizePixel = 0
- Frame17.Name = "Crosshair"
- Frame17.Parent = ScreenGui10
- Frame17.Size = UDim2.new(0, 2, 1, 0)
- Frame17.Position = UDim2.new(0.5, -1, 0, 0)
- Frame17.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame17.BorderColor3 = Color3.new(0, 0, 0)
- Frame17.BorderSizePixel = 0
- Frame18.Name = "Crosshair"
- Frame18.Parent = ScreenGui10
- Frame18.Size = UDim2.new(0, 2, 0, 2)
- Frame18.Position = UDim2.new(0.5, -1, 0.5, -16)
- Frame18.BackgroundColor3 = Color3.new(1, 0, 0)
- Frame18.BorderColor3 = Color3.new(0, 0, 0)
- Frame18.BorderSizePixel = 0
- Sound19.Name = "HeadshotPlayer1"
- Sound19.Parent = Tool0
- Sound19.SoundId = "rbxassetid://178070151"
- Sound19.Volume = 1
- Sound20.Name = "HeadshotPlayer2"
- Sound20.Parent = Tool0
- Sound20.SoundId = "rbxassetid://178072179"
- Sound20.Volume = 1
- BoolValue21.Name = "AimDown"
- BoolValue21.Parent = Tool0
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = owner.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Add Comment
Please, Sign In to add comment