Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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")
- LocalScript4 = Instance.new("LocalScript")
- Script5 = Instance.new("Script")
- Script6 = Instance.new("Script")
- NumberValue7 = Instance.new("NumberValue")
- Tool0.Name = "Railgun"
- Tool0.Parent = mas
- Tool0.TextureId = "http://www.roblox.com/asset/?id=79429068"
- Tool0.GripPos = Vector3.new(0, -0.75, 1.29999995)
- Tool0.ToolTip = "Railgun"
- Part1.Name = "Handle"
- Part1.Parent = Tool0
- Part1.BrickColor = BrickColor.new("Really black")
- Part1.Locked = true
- Part1.FormFactor = Enum.FormFactor.Custom
- Part1.Size = Vector3.new(0.5, 1.58000135, 4.71000051)
- Part1.CFrame = CFrame.new(-0.999999881, 0.0999954715, -1.00000012, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- Part1.Position = Vector3.new(-0.999999881, 0.0999954715, -1.00000012)
- Part1.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=79429148"
- SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=79429114"
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
- Sound3.Parent = Part1
- Sound3.SoundId = "http://www.roblox.com/asset/?id=77170656"
- Sound3.Volume = 1
- LocalScript4.Parent = Tool0
- table.insert(cors,sandbox(LocalScript4,function()
- --Made by Stickmasterluke
- sp=script.Parent
- plr=game.Players.localPlayer
- damage=9999999999999999913376412809999999999999999999999999999999999999999999999999999999999999999999999
- firerate=0
- range=1500
- barreloffset=Vector3.new(0, 0.25, -1.7)
- windvec=Vector3.new(2,-1,1).unit
- rate=1/30
- debris=game:GetService("Debris")
- equipped=false
- check=true
- function tagHumanoid(humanoid)
- local creator_tag=Instance.new("ObjectValue")
- creator_tag.Value=game.Players.LocalPlayer
- creator_tag.Name="creator"
- debris:AddItem(creator,3)
- creator_tag.Parent=humanoid
- 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" 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 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=5
- 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(2,dist*5,2)
- m.Parent=laser
- debris:AddItem(laser,fadedelay*3)
- laser.Parent=game.Workspace
- --wait(.25)
- local frames=fadedelay/rate
- for frame=1,frames do
- wait(rate)
- local percent=frame/frames
- --m.Scale=Vector3.new(1+(20*percent),dist*5,1+(20*percent))
- laser.CFrame=laser.CFrame+windvec*rate
- laser.Transparency=.5+(percent*.5)
- end
- wait(2)
- laser:remove()
- end
- function onEquipped(mouse)
- equipped=true
- if mouse~=nil then
- mouse.Icon="rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function()
- local he=sp.Parent:FindFirstChild("Head")
- local hu=sp.Parent:FindFirstChild("Humanoid")
- if check and he and hu and hu.Health>0 then
- check=false
- mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
- local startpos=he.Position
- local vec=(mouse.Hit.p-startpos).unit
- local hit,endpos=castray(startpos,vec,range,sp.Parent,false)
- local fakevec=(endpos-(sp.Handle.CFrame*CFrame.new(barreloffset)).p).unit
- sp.PlaySound.Value=tick()
- local rail=Instance.new("Part")
- rail.Friction=1
- rail.Name="Rail"
- rail.Anchored=false
- rail.CanCollide=true
- rail.formFactor="Custom"
- rail.Size=Vector3.new(.6,.4,8)
- rail.TopSurface="Smooth"
- rail.BottomSurface="Smooth"
- rail.BrickColor=BrickColor.new("Dark stone grey")
- debris:AddItem(rail,10)
- if hit and hit~=nil then
- local h=hit.Parent:FindFirstChild("Humanoid")
- if h~=nil and h.Health>0 then
- tagHumanoid(h)
- h.Parent:BreakJoints()
- end
- if not hit.Anchored then
- rail.Velocity=fakevec*200
- hit.CFrame=hit.CFrame+Vector3.new(0,.1,0)
- end
- local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.new(0,0,(math.random()*(rail.Size.z-2))-((rail.Size.z-2)/2))
- rail.CFrame=newcf
- local w=Instance.new("Weld")
- w.Part0=hit
- w.Part1=rail
- w.C0=hit.CFrame:inverse()*newcf
- w.C1=newcf:inverse()*newcf
- w.Parent=rail
- local soundscript=sp.SoundScript:clone()
- soundscript.Parent=rail
- soundscript.Disabled=false
- rail.Parent=game.Workspace
- if not hit.Anchored then
- hit.Velocity=hit.Velocity+fakevec*50
- end
- else
- rail.CFrame=CFrame.new(endpos,endpos+fakevec)
- rail.Velocity=fakevec*300
- rail.Parent=game.Workspace
- end
- delay(0,function() --This is nessecery to fire multible shots at the same time. For those who don't know, delay() is a poor man's coroutine.
- drawbeam((sp.Handle.CFrame*CFrame.new(barreloffset)).p,endpos,BrickColor.new("Institutional white"),2)
- end)
- wait(firerate)
- mouse.Icon="rbxasset://textures\\GunCursor.png"
- check=true
- end
- end)
- end
- end
- function onUnequipped()
- equipped=false
- end
- sp.Equipped:connect(onEquipped)
- sp.Unequipped:connect(onUnequipped)
- end))
- Script5.Name = "SoundScript"
- Script5.Parent = Tool0
- Script5.Disabled = true
- table.insert(cors,sandbox(Script5,function()
- --Stickamsterluke
- --this script this made so that the sound is not played locally
- sp=script.Parent
- local s=Instance.new("Sound")
- s.Volume=2
- s.SoundId="http://www.roblox.com/asset/?id=77170993"
- s.Looped=false
- s.PlayOnRemove=false
- s.Parent=sp
- wait()
- s:Play()
- end))
- Script6.Parent = Tool0
- table.insert(cors,sandbox(Script6,function()
- --Stickamsterluke
- --this script this made so that the sound is not played locally
- sp=script.Parent
- wait(1)
- sp.PlaySound.Changed:connect(function()
- sp.Handle.Sound:Play()
- end)
- end))
- NumberValue7.Name = "PlaySound"
- NumberValue7.Parent = Tool0
- NumberValue7.Value = 1336154690.422
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = game:GetService("Players").LocalPlayer.Backpack
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement