Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ignorelist = {}
- for i, wha in pairs(workspace:GetDescendants()) do
- if wha:IsA("Model") and wha:FindFirstChildWhichIsA("Humanoid") then
- table.insert(ignorelist,wha)
- end
- end
- workspace.DescendantAdded:Connect(function(wha)
- if wha:IsA("Model") and wha:FindFirstChildWhichIsA("Humanoid") then
- table.insert(ignorelist,wha)
- end
- end)
- e = Instance.new("RemoteEvent",owner.Character)
- local hed = Instance.new("Weld",owner.Character.Torso)
- hed.Part0 = owner.Character.Head
- hed.Part1 = hed.Parent
- hed.C0 = CFrame.new(0,-0.5,0)
- hed.C1 = CFrame.new(0,1,0)
- hed.Enabled = false
- local s = Instance.new("Sound")
- s.PlayOnRemove = true
- s.Volume = 0.6
- s.SoundId = "rbxassetid://6738503253"
- local tool = Instance.new("Tool",owner.Backpack)
- tool.Grip = CFrame.new(0.3,0.1,0.8) * CFrame.Angles(math.rad(-0.6),math.rad(-1.5),0)
- tool.Name = "railgu"
- local armw = Instance.new("Weld",owner.Character.Torso)
- armw.Part0 = owner.Character["Right Arm"]
- armw.Part1 = owner.Character.Torso
- armw.C1 = CFrame.new(1.5,0.5,0)
- armw.Enabled = false
- armw.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
- local part = Instance.new("Part",tool)
- part.Name = "Handle"
- part.Size = Vector3.new(6.883,11.953,33.644) * 0.145
- local m = Instance.new("SpecialMesh",part)
- m.MeshId = "rbxassetid://10522578887"
- m.TextureId = "rbxassetid://10522656175"
- m.Scale = Vector3.new(1,1,1) * 0.15
- local alpha = Instance.new("Texture",part)
- alpha.StudsPerTileU = 3
- alpha.StudsPerTileV = 3
- alpha.Texture = "rbxassetid://11259851647"
- alpha.Color3 = Color3.new(0,10000000000000,10000000000000)
- local at = Instance.new("Attachment",part)
- at.CFrame = CFrame.new(0.05,0.45,0.45) * CFrame.Angles(math.rad(-45),0,0)
- local light = Instance.new("PointLight",at)
- light.Color = Color3.fromRGB(0,170, 255)
- light.Brightness = 3
- light.Range = 5
- local part2 = Instance.new("Part",part)
- part2.CanCollide = false
- part2.Size = Vector3.new(4.352, 4.509, 27.894) * 0.15
- local m2 = Instance.new("SpecialMesh",part2)
- m2.MeshId = "rbxassetid://10522577480"
- m2.TextureId = "rbxassetid://10522656175"
- m2.Scale = Vector3.new(1,1,1) * 0.15
- local weld = Instance.new("Weld",part)
- weld.Part0 = part2
- weld.Part1 = part
- weld.C1 = CFrame.new(-0.45,-0.4,-0.8)
- weld.C0 = CFrame.new(0,0,2.05)
- local part3 = Instance.new("Part",part)
- part3.CanCollide = false
- part3.Size = Vector3.new(4.352, 4.509, 27.894) * 0.15
- local m3 = Instance.new("SpecialMesh",part3)
- m3.MeshId = "rbxassetid://10522579285"
- m3.TextureId = "rbxassetid://10522656175"
- m3.Scale = Vector3.new(1,1,1) * 0.15
- local weld2 = Instance.new("Weld",part)
- weld2.Part0 = part3
- weld2.Part1 = part
- weld2.C1 = CFrame.new(0.55,-0.4,-0.8)
- weld2.C0 = CFrame.new(0,0,2.05)
- local part4 = Instance.new("Part",part)
- part4.CanCollide = false
- part4.Size = Vector3.new(4.151, 5.202, 28.434) * 0.15
- local m4 = Instance.new("SpecialMesh",part4)
- m4.MeshId = "rbxassetid://10522578576"
- m4.TextureId = "rbxassetid://10522656175"
- m4.Scale = Vector3.new(1,1,1) * 0.15
- local weld3 = Instance.new("Weld",part)
- weld3.Part0 = part4
- weld3.Part1 = part
- weld3.C1 = CFrame.new(0.05,0.4,-0.8)
- weld3.C0 = CFrame.new(0,0,2.05)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522578076"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part)
- weld4.Part0 = part5
- weld4.Part1 = part
- weld4.C1 = CFrame.new(-0.5,-0.15,-0.3)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part3)
- weld4.Part0 = part5
- weld4.Part1 = part3
- weld4.C1 = CFrame.new(-0.03,0,0.3 + 0.85) * CFrame.Angles(0,0,math.rad(-45))
- weld4.C0 = CFrame.new(0,-0.25,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part3)
- weld4.Part0 = part5
- weld4.Part1 = part3
- weld4.C1 = CFrame.new(-0.025,0,0.3125) * CFrame.Angles(0,0,math.rad(-45))
- weld4.C0 = CFrame.new(0,-0.25,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part3)
- weld4.Part0 = part5
- weld4.Part1 = part3
- weld4.C1 = CFrame.new(0.075,0,-(0.525 + 0.85)) * CFrame.Angles(0,0,math.rad(-45))
- weld4.C0 = CFrame.new(0,-0.185,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part3)
- weld4.Part0 = part5
- weld4.Part1 = part3
- weld4.C1 = CFrame.new(0.025,0,-0.525) * CFrame.Angles(0,0,math.rad(-45))
- weld4.C0 = CFrame.new(0,-0.2,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part2)
- weld4.Part0 = part5
- weld4.Part1 = part2
- weld4.C1 = CFrame.new(0.03,0,0.3 + 0.85) * CFrame.Angles(0,0,math.rad(45))
- weld4.C0 = CFrame.new(0,-0.25,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part2)
- weld4.Part0 = part5
- weld4.Part1 = part2
- weld4.C1 = CFrame.new(0.025,0,0.3125) * CFrame.Angles(0,0,math.rad(45))
- weld4.C0 = CFrame.new(0,-0.25,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part2)
- weld4.Part0 = part5
- weld4.Part1 = part2
- weld4.C1 = CFrame.new(-0.075,0,-(0.525 + 0.85)) * CFrame.Angles(0,0,math.rad(45))
- weld4.C0 = CFrame.new(0,-0.185,0)
- local part5 = Instance.new("Part",part)
- part5.CanCollide = false
- part5.Size = Vector3.new(1,1,1) * 0.15
- local m5 = Instance.new("SpecialMesh",part5)
- m5.MeshId = "rbxassetid://10522577725"
- m5.TextureId = "rbxassetid://10522656175"
- m5.Scale = Vector3.new(1,1,1) * 0.15
- local weld4 = Instance.new("Weld",part2)
- weld4.Part0 = part5
- weld4.Part1 = part2
- weld4.C1 = CFrame.new(-0.025,0,-0.525) * CFrame.Angles(0,0,math.rad(45))
- weld4.C0 = CFrame.new(0,-0.2,0)
- local tweenService = game:GetService("TweenService")
- local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Back,Enum.EasingDirection.Out,0,true)
- local goal = {}
- goal.C0 = CFrame.new(0,0,2.05) * CFrame.Angles(math.rad(-35),0,0)
- local tween = tweenService:Create(weld3, tweenInfo, goal)
- local goal2 = {}
- goal2.C0 = CFrame.new(0,0,2.05) * CFrame.Angles(math.rad(25),math.rad(25),math.rad(-50))
- goal2.C1 = weld2.C1 * CFrame.Angles(0,0,math.rad(-50))
- local tween2 = tweenService:Create(weld2, tweenInfo, goal2)
- local goal3 = {}
- goal3.C0 = CFrame.new(0,0,2.05) * CFrame.Angles(math.rad(25),math.rad(-25),math.rad(50))
- goal3.C1 = weld.C1 * CFrame.Angles(0,0,math.rad(50))
- local tween3 = tweenService:Create(weld, tweenInfo, goal3)
- local tweenInfo = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
- local goal4 = {}
- goal4.C0 = CFrame.new(0,-0.8,-0.1) * CFrame.Angles(math.rad(-110),0,0)
- local tween4 = tweenService:Create(armw, tweenInfo, goal4)
- local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
- local goal5 = {}
- goal5.C0 = CFrame.new(0,-0.3,-0.05) * CFrame.Angles(math.rad(-85),0,0)
- local tween5 = tweenService:Create(armw, tweenInfo, goal5)
- local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Quart,Enum.EasingDirection.Out)
- local goal6 = {}
- goal6.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
- local tween6 = tweenService:Create(armw, tweenInfo, goal6)
- local tweenInfo = TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)
- local goa = {}
- goa.C0 = owner.Character.HumanoidRootPart:FindFirstChildWhichIsA("Motor6D").C0 * CFrame.Angles(math.rad(-5),0,0)
- local twee = tweenService:Create(owner.Character.HumanoidRootPart:FindFirstChildWhichIsA("Motor6D"), tweenInfo, goa)
- tween4.Completed:Connect(function()
- tween5:Play()
- end)
- tween5.Completed:Connect(function()
- tween6:Play()
- end)
- local db = false
- tool.Activated:Connect(function()
- if not db then
- db = true
- alpha.Transparency = 1
- light.Brightness = 0
- tween:Play()
- twee:Play()
- tween2:Play()
- tween3:Play()
- tween4:Play()
- local muzzle = Instance.new("Part",script)
- muzzle.CanCollide = false
- muzzle.CanQuery = false
- muzzle.Anchored = true
- s.Parent = muzzle
- s.Parent = nil
- muzzle.CFrame = part.CFrame * CFrame.new(0,0,-0.8)
- muzzle.Position = muzzle.Position + part.Velocity * owner:GetNetworkPing()
- muzzle.Transparency = 1
- local attachment0 = Instance.new("Attachment")
- attachment0.Parent = muzzle
- local attachment1 = Instance.new("Attachment")
- attachment1.Parent = workspace.Terrain
- attachment1.WorldCFrame = attachment0.WorldCFrame
- local params = RaycastParams.new()
- params.FilterDescendantsInstances = {owner.Character,script,ignorelist}
- params.FilterType = Enum.RaycastFilterType.Blacklist
- local res = workspace:Raycast(owner.Character.Head.Position,owner.Character.Head.CFrame.lookVector * 5000, params)
- local beam = Instance.new("Beam")
- beam.Width0 = 0.25
- beam.Width1 = 0.2
- local p = nil
- if res then
- p = CFrame.new(res.Position)
- else
- p = owner.Character.Head.CFrame * CFrame.new(0,0,-7000)
- beam.Width1 = 0.125
- end
- local hitalready = {}
- for _, what in pairs(workspace:GetPartBoundsInBox(muzzle.CFrame:Lerp(p,0.5) * CFrame.Angles(muzzle.CFrame:Lerp(p,0.5):Inverse():ToEulerAnglesXYZ()) * CFrame.Angles(CFrame.new(muzzle.Position,p.Position):ToEulerAnglesXYZ()), Vector3.new(0.005,0.005,(p.Position - (muzzle.Position + muzzle.Velocity * owner:GetNetworkPing())).Magnitude))) do
- if what:FindFirstAncestorWhichIsA("Model") and what:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid") and not table.find(hitalready,what) and what:FindFirstAncestorWhichIsA("Model") ~= owner.Character then
- what:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid").Health -= 180
- table.insert(hitalready,what)
- end
- end
- beam.Attachment0 = attachment0
- beam.Attachment1 = attachment1
- beam.CurveSize0 = 0
- beam.CurveSize1 = 0
- beam.FaceCamera = true
- beam.LightInfluence = 0
- beam.Segments = 10
- beam.LightEmission = 1
- beam.Brightness = 0.8
- beam.Color = ColorSequence.new{ColorSequenceKeypoint.new(0, Color3.fromRGB(16, 207, 232)),ColorSequenceKeypoint.new(1, Color3.fromRGB(12, 218, 245))}
- beam.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, 0.9),NumberSequenceKeypoint.new(1, 0.9)}
- local gg = {}
- gg.WorldCFrame = p
- local tweenInfoo = TweenInfo.new(0.08,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
- local tttt = tweenService:Create(attachment1, tweenInfoo, gg)
- tttt:Play()
- local g = {}
- g.Width0 = 0.1
- g.Width1 = 0.1
- g.Brightness = 0.2
- local tweenInfo = TweenInfo.new(0.3,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
- local t = tweenService:Create(beam, tweenInfo, g)
- coroutine.wrap(function()
- ctime = 0
- duration = 0.12
- local rot = false
- tasefunc = game:GetService("RunService").Stepped:Connect(function(_, delta)
- rot = not rot
- if rot then
- local r = math.random(-20,20)/30
- beam.CurveSize0 = r
- beam.CurveSize1 = -r
- end
- ctime = ctime + delta
- if ctime > duration then
- tasefunc:Disconnect()
- end
- end)
- end)()
- coroutine.wrap(function()
- for i = -1,100,1 do
- wait(0.001)
- beam.Transparency = NumberSequence.new{NumberSequenceKeypoint.new(0, (0.072 * i)),NumberSequenceKeypoint.new(1, (0.072 * i))}
- end
- end)()
- beam.Parent = muzzle
- coroutine.wrap(function()
- wait(0.1)
- t:Play()
- game:GetService("Debris"):AddItem(muzzle,0.3)
- wait(0.4)
- local ii = 0
- for i = 0.8, 0, -0.1 do
- ii = ii + 0.125
- alpha.Transparency = i
- light.Brightness = 15 * ii
- wait(0.0625)
- end
- db = false
- end)()
- end
- end)
- local equip = Instance.new("Sound")
- equip.PlayOnRemove = true
- equip.Volume = 1
- equip.SoundId = "rbxassetid://6870002623"
- tool.Equipped:Connect(function()
- equip.Parent = part
- equip.Parent = nil
- end)
- tool.Equipped:Connect(function()
- armw.Enabled = true
- hed.Enabled = true
- end)
- tool.Unequipped:Connect(function()
- armw.Enabled = false
- hed.Enabled = false
- end)
- e.OnServerEvent:Connect(function(_,cam,c1,alpha,hitcf,sw,wcs,shift)
- local lookvector = owner.Character.HumanoidRootPart.CFrame:toObjectSpace(cam).lookVector.unit
- hed.C0 = hed.C0:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(-lookvector.y,0,0),0.5)
- hed.C0 = hed.C0 * CFrame.Angles(sw.y,0,0)
- if shift then
- if lookvector.y > 0 then
- armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(lookvector.y + sw.y,-(sw.x),0) * CFrame.new(0,0,-0.5 * lookvector.y),0.5)
- armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
- else
- armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(lookvector.y + sw.y,-(sw.x),0) * CFrame.new(0,0,-1.5 * lookvector.y),0.5)
- armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
- end
- else
- if lookvector.y > 0 then
- armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(lookvector.y + sw.y,0,0) * CFrame.new(0,0,-0.5 * lookvector.y),0.5)
- armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
- else
- armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.5,0) * CFrame.Angles(lookvector.y + sw.y,0,0) * CFrame.new(0,0,-1.5 * lookvector.y),0.5)
- armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
- end
- end
- end)
- NLS([[
- e = script.Parent
- local tool = owner.Backpack:WaitForChild("railgu")
- eq = false
- tool.Equipped:Connect(function()
- eq = true
- end)
- tool.Unequipped:Connect(function()
- eq = false
- end)
- local ITERATIONS = 8
- local SPRING = {}
- function SPRING.create(self, mass, force, damping, speed)
- local spring = {
- Target = Vector3.new();
- Position = Vector3.new();
- Velocity = Vector3.new();
- Mass = mass or 5;
- Force = force or 50;
- Damping = damping or 4;
- Speed = speed or 4;
- }
- function spring.shove(self, force)
- local x, y, z = force.X, force.Y, force.Z
- if x ~= x or x == math.huge or x == -math.huge then
- x = 0
- end
- if y ~= y or y == math.huge or y == -math.huge then
- y = 0
- end
- if z ~= z or z == math.huge or z == -math.huge then
- z = 0
- end
- self.Velocity = self.Velocity + Vector3.new(x, y, z)
- end
- function spring.update(self, dt)
- local scaledDeltaTime = math.min(dt,1) * self.Speed / ITERATIONS
- for i = 1, ITERATIONS do
- local iterationForce = self.Target - self.Position
- local acceleration = (iterationForce * self.Force) / self.Mass
- acceleration = acceleration - (self.Velocity * self.Damping)
- self.Velocity = self.Velocity + (acceleration * scaledDeltaTime)
- self.Position = self.Position + (self.Velocity * scaledDeltaTime)
- end
- return self.Position
- end
- return spring
- end
- local wc = SPRING.create()
- local sway = SPRING.create()
- local bobspeed = 1
- local bobmod = .1
- local alpha = .25
- local hitcf = CFrame.new()
- local function gb(addition, speed, modifier)
- return math.sin(tick() * addition * speed) * modifier
- end
- c1 = CFrame.new(0,0,0)
- c2 = CFrame.new(0,0,0)
- local UIS = game:GetService("UserInputService")
- shift = false
- UIS:GetPropertyChangedSignal("MouseBehavior"):Connect(function()
- if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
- shift = true
- elseif UIS.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
- shift = false
- end
- end)
- game:GetService("RunService").RenderStepped:Connect(function(dt)
- if eq then
- delta = game:GetService("UserInputService"):GetMouseDelta()
- local vel = owner.Character.HumanoidRootPart.Velocity
- local msway = Vector3.new(gb(10, bobspeed, bobmod), gb(5, bobspeed, bobmod), gb(5, bobspeed, bobmod))
- sway:shove(Vector3.new(delta.X / 500, delta.Y / 500))
- wc:shove((msway / 25) * dt * 60 * math.clamp(vel.Magnitude,0,30))
- local sw = sway:update(dt)
- local wcs = wc:update(dt)
- e:FireServer(workspace.CurrentCamera.CFrame,c1,alpha,hitcf,sw,wcs,shift)
- end
- end)
- ]],e)
Add Comment
Please, Sign In to add comment