Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- debounce = false
- owner.Character.Head.Transparency = 1
- owner.Character.Humanoid:RemoveAccessories()
- local function customExplosion(position, radius, maxDamage)
- local explosion = Instance.new("Explosion")
- explosion.BlastPressure = 50 -- this could be set higher to still apply velocity to parts
- explosion.DestroyJointRadiusPercent = 0 -- joints are safe
- explosion.BlastRadius = radius
- explosion.Position = position
- -- set up a table to track the models hit
- local modelsHit = {}
- -- listen for contact
- explosion.Hit:Connect(function(part, distance)
- local parentModel = part.Parent
- if parentModel then
- -- check to see if this model has already been hit
- if modelsHit[parentModel] then
- return
- end
- -- log this model as hit
- modelsHit[parentModel] = true
- -- look for a humanoid
- local humanoid = parentModel:FindFirstChild("Humanoid")
- if humanoid and humanoid ~= owner.Character.Humanoid then
- local distanceFactor = distance / explosion.BlastRadius -- get the distance as a value between 0 and 1
- distanceFactor = 1 - distanceFactor
- humanoid.Health = humanoid.Health - (maxDamage * distanceFactor)
- end
- end
- end)
- explosion.Parent = game.Workspace
- local part1 = Instance.new("Part", script)
- part1.Size = Vector3.new(15, 15, 15)
- part1.Position = position
- part1.CanCollide = false
- part1.Anchored = true
- part1.Material = "Neon"
- part1.BrickColor = BrickColor.new("New Yeller")
- part1.Transparency = 0.5
- game:GetService("Debris"):AddItem(part1,0.5)
- for i = 1, 10 do
- wait(0.0885)
- part1.CFrame = part1.CFrame * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
- end
- end
- Brick = Instance.new("Part", owner.Character)
- Brick.Size = Vector3.new(1,1,2.5)
- Brick.Material = Enum.Material.SmoothPlastic
- Brick.CFrame = owner.Character.HumanoidRootPart.CFrame* CFrame.new(0,-0.25,5)
- Brick:SetNetworkOwner(owner)
- Brick.Name = "Block"
- Brick.CanCollide = false
- Brick2 = Instance.new("Part", owner.Character)
- Brick2.Size = Vector3.new(1.5,2,1.5)
- Brick2.Material = Enum.Material.SmoothPlastic
- Brick2.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,-1.25,5)
- Brick2:SetNetworkOwner(owner)
- Brick2.Name = "Block2"
- Brick3 = Instance.new("Part", owner.Character)
- Brick3.Size = Vector3.new(1,1,1)
- Brick3.Material = Enum.Material.SmoothPlastic
- Brick3.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0.25,0.375)
- Brick3:SetNetworkOwner(owner)
- Brick3.Name = "Block3"
- Brick3.CanCollide = false
- Brick3.Transparency = 1
- Brick3.Massless = true
- Brick2.Massless = true
- Brick.Massless = true
- local density = 0.5
- local friction = 0.5
- local elasticity = 1
- local frictionWeight = 0
- local elasticityWeight = 100000000000
- local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
- local b = Instance.new("BodyVelocity",Brick)
- b.MaxForce = Vector3.new(500000,500000,500000)
- b.Velocity = Vector3.new()
- gun = Instance.new("RemoteEvent",owner.Character)
- gun.Name = "the thing you shoot"
- explodemode = false
- gun.OnServerEvent:Connect(function(plr, action)
- if action == "explodemode" then
- explodemode = true
- elseif action == "Normal" then
- explodemode = false
- end
- if action == "shoot" then
- local bullet = Instance.new("SpawnLocation",script)
- bullet.Enabled = false
- bullet.CFrame = Brick.CFrame * CFrame.new(0,0,-5)
- bullet.Size = Vector3.new(0.75,0.75,2.5)
- bullet.Material = Enum.Material.SmoothPlastic
- bullet.CustomPhysicalProperties = physProperties
- if explodemode then
- bullet.BrickColor = BrickColor.new("Bright red")
- game:GetService("Debris"):AddItem(bullet,5)
- bullet:ApplyImpulse(bullet.CFrame.lookVector * 165)
- elseif not explodemode then
- bullet.BrickColor = BrickColor.new("New Yeller")
- game:GetService("Debris"):AddItem(bullet,7.5)
- bullet:ApplyImpulse(bullet.CFrame.lookVector * 200)
- end
- bullet.Touched:Connect(function(partlol)
- local partParent3 = partlol.Parent
- local humanoid = partParent3:FindFirstChildWhichIsA("Humanoid")
- if humanoid ~= owner.Character.Humanoid and humanoid then
- if not debounce then
- debounce = true
- if explodemode then
- customExplosion(bullet.Position,15,100)
- wait()
- bullet:Destroy()
- debounce = false
- elseif not explodemode then
- humanoid.Health = humanoid.Health - 35
- wait()
- bullet:Destroy()
- debounce = false
- end
- end
- end
- end)
- end
- end)
- Brickweld2 = Instance.new("NoCollisionConstraint",Brick2)
- Brickweld2.Part0 = Brick
- Brickweld2.Part1 = Brick2
- Brickweld = Instance.new("Weld",Brick2)
- Brickweld.Part0 = Brick3
- Brickweld.Part1 = Brick2
- Brickweld.C0 = CFrame.new(0,-1,0.375)
- local attachment0 = Instance.new("Attachment")
- attachment0.Parent = Brick2
- local attachment1 = Instance.new("Attachment")
- attachment1.Parent = owner.Character.Head
- alignposition = Instance.new("HingeConstraint")
- alignposition.Parent = owner.Character.Head
- alignposition.Attachment0 = attachment0
- alignposition.Attachment1 = attachment1
- attachment1.WorldCFrame = attachment1.Parent.CFrame * CFrame.new(0,0.75,0) * CFrame.Angles(0,0,math.rad(90))
- attachment0.WorldCFrame = attachment0.Parent.CFrame * CFrame.Angles(0,0,math.rad(90))
- NLS([[
- gun = owner.Character:WaitForChild("the thing you shoot")
- local mouse = owner:GetMouse()
- Brick = owner.Character:WaitForChild("Block")
- Brick2 = owner.Character:WaitForChild("Block2")
- Brick3 = owner.Character:WaitForChild("Block3")
- local bg = Instance.new("BodyGyro",Brick)
- bg.D = 100
- bg.P = 100000
- bg.MaxTorque = Vector3.new(1000000,1000000,1000000)
- game:GetService("RunService").RenderStepped:Connect(function()
- TweenService = game:GetService("TweenService")
- spininfo = TweenInfo.new(0.125,Enum.EasingStyle.Linear)
- spininfo2 = TweenInfo.new(0.125,Enum.EasingStyle.Linear)
- Spin1 = TweenService:Create(Brick2,spininfo,{CFrame = CFrame.new(Brick2.Position,Vector3.new(mouse.Hit.p.x,Brick2.Position.y,mouse.Hit.p.z))})
- Brick.Position = Brick3.Position
- Spin2 = TweenService:Create(bg,spininfo2,{CFrame = CFrame.new(Brick3.Position,Vector3.new(mouse.Hit.p.x,mouse.Hit.p.y,mouse.Hit.p.z))})
- Spin1:Play()
- Spin2:Play()
- end)
- MouseHold = false
- count = 0
- mouse.KeyDown:Connect(function(key)
- key = key:lower()
- if key == "e" then
- count = count + 1
- if count == 1 then
- gun:FireServer("explodemode")
- elseif count == 2 then
- gun:FireServer("Normal")
- task.wait()
- count = 0
- end
- end
- end)
- mouse.Button1Down:Connect(function()
- gun:FireServer("shoot")
- MouseHold = true
- end)
- mouse.Button1Up:Connect(function()
- MouseHold = false
- end)
- while true do
- wait(0.0625)
- if MouseHold then
- gun:FireServer("shoot")
- end
- end
- ]], owner.Character)
Add Comment
Please, Sign In to add comment