Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rayblacklist = {}
- workspace.DescendantAdded:Connect(function(WHAT) -- thank rufus
- if WHAT:IsA("Accessory") or WHAT:IsA("Hat") then
- table.insert(rayblacklist, WHAT)
- elseif WHAT:IsA("BasePart") and not WHAT.CanCollide then
- table.insert(rayblacklist, WHAT)
- end
- end)
- for i,v in pairs(owner.Character:GetDescendants()) do
- pcall(function()
- table.insert(rayblacklist, v)
- end)
- end
- off = false
- owner.Chatted:Connect(function(msg)
- if string.lower(msg) == "deactivate sentry" then
- off = true
- elseif string.lower(msg) == "activate sentry" then
- off = false
- end
- end)
- local part1 = Instance.new("Part", script)
- local part2 = Instance.new("Part", part1)
- part1.Size = Vector3.new(1.25,1,1.75)
- part2.Size = Vector3.new(1,2,2)
- part2.Shape = "Cylinder"
- part2.Color = Color3.fromRGB(199, 20, 0)
- part1.Color = Color3.fromRGB(199, 20, 0)
- part2.Material = "SmoothPlastic"
- part1.Material = "SmoothPlastic"
- local part3 = Instance.new("Part", part1)
- part3.Size = Vector3.new(1.0625,1.65,1.65)
- part3.Shape = "Cylinder"
- part3.Color = Color3.fromRGB(43, 43, 43)
- part3.Material = "SmoothPlastic"
- local part4 = Instance.new("Part", part1)
- part4.Size = Vector3.new(1.255,1.005,0.95)
- part4.Color = Color3.fromRGB(43, 43, 43)
- part4.Material = "SmoothPlastic"
- local part5 = Instance.new("Part", part1)
- part5.Size = Vector3.new(0.01,2.01,2.01)
- part5.Shape = "Cylinder"
- part5.Color = Color3.fromRGB(43, 43, 43)
- part5.Material = "SmoothPlastic"
- local part6 = Instance.new("Part", part1)
- part6.Size = Vector3.new(0.01,2.01,2.01)
- part6.Shape = "Cylinder"
- part6.Color = Color3.fromRGB(43, 43, 43)
- part6.Material = "SmoothPlastic"
- local part7 = Instance.new("Part", part1)
- part7.Size = Vector3.new(1.251,0.01,1.4)
- part7.Color = Color3.fromRGB(43, 43, 43)
- part7.Material = "SmoothPlastic"
- local part8 = Instance.new("Part", part1)
- part8.Size = Vector3.new(1.251,0.01,1.4)
- part8.Color = Color3.fromRGB(43, 43, 43)
- part8.Material = "SmoothPlastic"
- local part9 = Instance.new("Part", part1)
- part9.Size = Vector3.new(0.75,0.3,0.3)
- part9.Shape = "Cylinder"
- part9.Color = Color3.fromRGB(43, 43, 43)
- part9.Material = "SmoothPlastic"
- local part10 = Instance.new("Part", part1)
- part10.Size = Vector3.new(0.1,0.4,0.4)
- part10.Shape = "Cylinder"
- part10.Color = Color3.fromRGB(43, 43, 43)
- part10.Material = "SmoothPlastic"
- local part11 = Instance.new("Part", part1)
- part11.Size = Vector3.new(0.23,0.2,0.2)
- part11.Shape = "Cylinder"
- part11.Color = Color3.fromRGB(43, 43, 43)
- part11.Material = "SmoothPlastic"
- local part12 = Instance.new("Part", part1)
- part12.Size = Vector3.new(0.1,0.1,0.1)
- part12.Shape = "Cylinder"
- part12.Color = Color3.fromRGB(43, 43, 43)
- part12.Material = "SmoothPlastic"
- local part13 = Instance.new("Part", part1)
- part13.Size = Vector3.new(0.125,0.075,0.075)
- part13.Shape = "Cylinder"
- part13.Color = Color3.fromRGB(199, 20, 0)
- part13.Material = "Neon"
- local part14 = Instance.new("Part", part1)
- part14.Size = Vector3.new(0.13,0.08,0.08)
- part14.Shape = "Cylinder"
- part14.Color = Color3.fromRGB(199, 20, 0)
- part14.Transparency = 0.4
- part14.Material = "Glass"
- local part15 = Instance.new("Part", part1)
- part15.Size = Vector3.new(1.5,0.35,0.35)
- part15.Shape = "Cylinder"
- part15.Color = Color3.fromRGB(43, 43, 43)
- part15.Material = "SmoothPlastic"
- part15.Anchored = true
- local part16 = Instance.new("Part", part1)
- part16.Size = Vector3.new(0.125,0.45,0.45)
- part16.Shape = "Cylinder"
- part16.Color = Color3.fromRGB(43, 43, 43)
- part16.Material = "SmoothPlastic"
- part16.Anchored = true
- local part20 = Instance.new("Part", part1)
- part20.Size = Vector3.new(2,0.35,0.35)
- part20.Shape = "Cylinder"
- part20.Color = Color3.fromRGB(43, 43, 43)
- part20.Material = "SmoothPlastic"
- local part21 = Instance.new("Part", part1)
- part21.Size = Vector3.new(2,0.35,0.35)
- part21.Shape = "Cylinder"
- part21.Color = Color3.fromRGB(43, 43, 43)
- part21.Material = "SmoothPlastic"
- local part22 = Instance.new("Part", part1)
- part22.Size = Vector3.new(2,0.35,0.35)
- part22.Shape = "Cylinder"
- part22.Color = Color3.fromRGB(43, 43, 43)
- part22.Material = "SmoothPlastic"
- local part17 = Instance.new("Part", part1)
- part17.Size = Vector3.new(1.65,0.125,1)
- part17.Color = Color3.fromRGB(43, 43, 43)
- part17.Material = "SmoothPlastic"
- local part18 = Instance.new("Part", part17)
- part18.Size = Vector3.new(0.125,1.5,1)
- part18.Color = Color3.fromRGB(43, 43, 43)
- part18.Material = "SmoothPlastic"
- local part19 = Instance.new("Part", part17)
- part19.Size = Vector3.new(0.125,1.5,1)
- part19.Color = Color3.fromRGB(43, 43, 43)
- part19.Material = "SmoothPlastic"
- part19.Massless = true
- part18.Massless = true
- part17.Massless = true
- part16.Massless = true
- part15.Massless = true
- part14.Massless = true
- part13.Massless = true
- part12.Massless = true
- part11.Massless = true
- part10.Massless = true
- part9.Massless = true
- part8.Massless = true
- part7.Massless = true
- part6.Massless = true
- part5.Massless = true
- part3.Massless = true
- part2.Massless = true
- part1.Massless = true
- for i,v in pairs(script:GetDescendants()) do
- pcall(function()
- table.insert(rayblacklist, v)
- end)
- end
- local weld = Instance.new("Weld", part1)
- weld.Part0 = part2
- weld.Part1 = part1
- weld.C0 = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(0,0,-1.35)
- local weld2 = Instance.new("Weld", part1)
- weld2.Part0 = part3
- weld2.Part1 = part1
- weld2.C0 = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(0,0,-1.35)
- local weld3 = Instance.new("Weld", part1)
- weld3.Part0 = part4
- weld3.Part1 = part1
- weld3.C0 = CFrame.new(0,0,0.39)
- local weld4 = Instance.new("Weld", part1)
- weld4.Part0 = part5
- weld4.Part1 = part1
- weld4.C0 = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(0,0.4,-1.35)
- local weld5 = Instance.new("Weld", part1)
- weld5.Part0 = part6
- weld5.Part1 = part1
- weld5.C0 = CFrame.Angles(0,0,math.rad(90)) * CFrame.new(0,-0.4,-1.35)
- local weld6 = Instance.new("Weld", part1)
- weld6.Part0 = part7
- weld6.Part1 = part1
- weld6.C0 = CFrame.new(0,-0.4,0)
- local weld7 = Instance.new("Weld", part1)
- weld7.Part0 = part8
- weld7.Part1 = part1
- weld7.C0 = CFrame.new(0,0.4,0)
- local weld8 = Instance.new("Weld", part1)
- weld8.Part0 = part9
- weld8.Part1 = part1
- weld8.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(0,0,1)
- local weld9 = Instance.new("Weld", part1)
- weld9.Part0 = part10
- weld9.Part1 = part1
- weld9.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(0,0,0.85)
- local weld10 = Instance.new("Weld", part1)
- weld10.Part0 = part11
- weld10.Part1 = part1
- weld10.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(-0.375,0.3,0.85)
- local weld11 = Instance.new("Weld", part1)
- weld11.Part0 = part12
- weld11.Part1 = part1
- weld11.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(-0.4,0.05,0.85)
- local weld12 = Instance.new("Weld", part1)
- weld12.Part0 = part13
- weld12.Part1 = part1
- weld12.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(-0.4,0.05,0.95)
- local weld13 = Instance.new("Weld", part1)
- weld13.Part0 = part14
- weld13.Part1 = part1
- weld13.C0 = CFrame.Angles(0,math.rad(90),0) * CFrame.new(-0.4,0.05,0.95)
- local weld14 = Instance.new("Weld", part17)
- weld14.Part0 = part18
- weld14.Part1 = part17
- weld14.C0 = CFrame.new(-0.8,-0.7,0)
- local weld15 = Instance.new("Weld", part17)
- weld15.Part0 = part19
- weld15.Part1 = part17
- weld15.C0 = CFrame.new(0.8,-0.7,0)
- local weld16 = Instance.new("Weld", part15)
- weld16.Part0 = part20
- weld16.Part1 = part15
- weld16.C0 = CFrame.Angles(0,math.rad(22.5),math.rad(45)) * CFrame.new(0.75,-0.75,0.5)
- local weld17 = Instance.new("Weld", part15)
- weld17.Part0 = part21
- weld17.Part1 = part15
- weld17.C0 = CFrame.Angles(0,math.rad(22.5),math.rad(-45)) * CFrame.new(0.75,0.75,0.5)
- local weld18 = Instance.new("Weld", part15)
- weld18.Part0 = part22
- weld18.Part1 = part15
- weld18.C0 = CFrame.Angles(0,math.rad(-45),0) * CFrame.new(0.75,0,-0.75)
- part1.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,0.5,-5)
- part17.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.new(0,-0.35,-5.25)
- part17.CanCollide = false
- part18.CanCollide = false
- part19.CanCollide = false
- local alert = Instance.new("Sound", part4)
- alert.Volume = 2
- alert.SoundId = "rbxassetid://8182830328"
- local searching = Instance.new("Sound", part4)
- searching.Volume = 2
- searching.Looped = true
- searching.SoundId = "rbxassetid://8191866994"
- local shooting = Instance.new("Sound", part4)
- shooting.Volume = 2
- shooting.Looped = true
- shooting.SoundId = "rbxassetid://7615746395"
- local shooting2 = Instance.new("Sound", part4)
- shooting2.Volume = 2
- shooting2.Looped = true
- shooting2.SoundId = "rbxassetid://7615746395"
- part15.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.Angles(0,0,math.rad(90)) * CFrame.new(-1.125,0,-5.25)
- part16.CFrame = owner.Character.HumanoidRootPart.CFrame * CFrame.Angles(0,0,math.rad(90)) * CFrame.new(-0.5,0,-5.25)
- alignposition = Instance.new("HingeConstraint")
- alignposition.Parent = part17
- alignposition.ActuatorType = Enum.ActuatorType.None
- local at0 = Instance.new("Attachment")
- at0.Parent = part17
- at0.WorldCFrame = part4.CFrame
- local at1 = Instance.new("Attachment")
- at1.Parent = part4
- at1.WorldCFrame = at1.Parent.CFrame
- alignposition.Attachment0 = at0
- alignposition.Attachment1 = at1
- alignposition2 = Instance.new("HingeConstraint")
- alignposition2.Parent = part16
- alignposition2.ActuatorType = Enum.ActuatorType.None
- local at2 = Instance.new("Attachment")
- at2.Parent = part16
- at2.WorldCFrame = part17.CFrame * CFrame.Angles(0,0,math.rad(90))
- local at3 = Instance.new("Attachment")
- at3.Parent = part17
- at3.WorldCFrame = at3.Parent.CFrame * CFrame.Angles(0,0,math.rad(90))
- alignposition2.Attachment0 = at2
- alignposition2.Attachment1 = at3
- bg = Instance.new("BodyGyro",part4)
- bg.P = 10000
- bg.D = 500
- bg.MaxTorque = Vector3.new(math.huge,0,0)
- bg2 = Instance.new("BodyGyro",part17)
- bg2.P = 10000
- bg2.D = 500
- bg2.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
- bg.CFrame = part4.CFrame
- bg2.CFrame = part17.CFrame
- TweenService = game:GetService("TweenService")
- spininfo = TweenInfo.new(0.75,Enum.EasingStyle.Linear)
- Spin1 = TweenService:Create(bg2,spininfo,{CFrame = bg2.CFrame * CFrame.Angles(0,math.rad(85),0)})
- Spin2 = TweenService:Create(bg2,spininfo,{CFrame = bg2.CFrame * CFrame.Angles(0,math.rad(45),0)})
- Spin5 = TweenService:Create(bg2,spininfo,{CFrame = bg2.CFrame * CFrame.Angles(0,math.rad(0),0)})
- Spin3 = TweenService:Create(bg2,spininfo,{CFrame = bg2.CFrame * CFrame.Angles(0,math.rad(-85),0)})
- Spin4 = TweenService:Create(bg2,spininfo,{CFrame = bg2.CFrame * CFrame.Angles(0,math.rad(-45),0)})
- Spin6 = TweenService:Create(bg,spininfo,{CFrame = bg.CFrame})
- damaging = false
- candamage = true
- nowall = true
- function wallcheck(who,mod)
- local iforgor = {}
- local raycastParams = RaycastParams.new()
- raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
- raycastParams.FilterDescendantsInstances = {rayblacklist,who,mod}
- raycastParams.IgnoreWater = true
- local result = workspace:Raycast(part.Position, CFrame.new(part4.Position,who.Position).lookVector * (part4.Position - who.Position).Magnitude, raycastParams)
- if result then
- table.insert(iforgor,mod)
- end
- return iforgor
- end
- function move(target)
- local dir = (target.Position - part4.Position).unit
- local spawnPos = part4.Position
- local pos = spawnPos + (dir * 1)
- local cf = CFrame.new(pos, pos + dir * 50)
- coroutine.wrap(function()
- pcall(function()
- if not off and candamage then
- candamage = false
- local hum = target.Parent:findFirstChild("Humanoid")
- hum.Health = hum.Health - 15
- pcall(function()
- local Flame3 = Instance.new("SpawnLocation", script)
- Flame3.Size = Vector3.new(0.5,0.5,0.5)
- Flame3.Neutral = false
- Flame3.Enabled = false
- Flame3.CFrame = part4.CFrame * CFrame.new(0,0,-1.25) * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
- Flame3.CanCollide = false
- Flame3.Color = Color3.fromRGB(255, 50, 50)
- Flame3.Material = "Neon"
- Flame3.Anchored = true
- Flame3.Name = "Flameslol"
- game:GetService("Debris"):AddItem(Flame3,0.5)
- local timeToFade6 = 0.5
- local object6 = Flame3
- local tweenInfo6 = TweenInfo.new(timeToFade6)
- local goal9 = {}
- goal9.Color = Color3.fromRGB(255, 155, 0)
- local tween9 = tweenService:Create(object6, tweenInfo6, goal9)
- tween9:Play()
- local flash = Instance.new("PointLight", Flame3)
- flash.Brightness = 3
- game:GetService("Debris"):AddItem(flash,0.5)
- for i = 1, 4 do
- wait(0.0125)
- Flame3.CFrame = Flame3.CFrame * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
- end
- end)
- wait(0.5)
- candamage = true
- end
- end)
- end)()
- end
- function findNearestTorso(pos,forgort)
- pcall(function()
- local list = workspace:GetChildren()
- local torso = nil
- local dist = 50
- local temp = nil
- local human = nil
- local temp2 = nil
- for x = 1, #list do
- temp2 = list[x]
- if (temp2.className == "Model") and (temp2 ~= owner.Character) and not table.find(forgort,temp2) then
- temp = temp2:findFirstChild("Head")
- human = temp2:findFirstChild("Humanoid")
- if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
- if (temp.Position - pos).magnitude < dist then
- torso = temp
- dist = (temp.Position - pos).magnitude
- end
- end
- end
- end
- return torso,temp2
- end)
- end
- db = false
- db2 = false
- function targetlocked()
- coroutine.wrap(function()
- if not db then
- db = true
- searching:Stop()
- alert:Play()
- alert.Ended:Wait()
- shooting:Play()
- wait(1.5)
- shooting2:Play()
- end
- end)()
- end
- local nowall = true
- function targetnil()
- coroutine.wrap(function()
- if not db2 then
- db2 = true
- searching:Play()
- shooting:Stop()
- shooting2:Stop()
- end
- end)()
- end
- coroutine.wrap(function()
- while true do
- if not off then
- local torso,temp2 = findNearestTorso(part4.Position)
- if torso~=nil and temp2 ~= nil then
- local iforgor = wallcheck(torso,temp2)
- local torso,temp2 = findNearestTorso(part4.Position,iforgor)
- if torso~=nil then
- move(torso)
- nowall = true
- targetlocked()
- db2 = false
- else
- nowall = false
- db = false
- targetnil()
- end
- end
- task.wait()
- end
- end
- end)()
- cycled = false
- wait()
- while true do
- task.wait()
- if not cycled then
- cycled = true
- Spin6:Play()
- if db2 then
- coroutine.wrap(function()
- Spin2:Play()
- wait(0.75)
- Spin1:Play()
- wait(0.75)
- Spin2:Play()
- wait(0.75)
- Spin5:Play()
- wait(0.75)
- Spin4:Play()
- wait(0.75)
- Spin3:Play()
- wait(0.75)
- Spin4:Play()
- wait(0.75)
- Spin5:Play()
- wait(0.75)
- cycled = false
- end)()
- elseif not nowall then
- Spin1:Cancel()
- Spin2:Cancel()
- Spin3:Cancel()
- Spin4:Cancel()
- Spin5:Cancel()
- Spin6:Cancel()
- cycled = false
- elseif not db2 then
- Spin1:Cancel()
- Spin2:Cancel()
- Spin3:Cancel()
- Spin4:Cancel()
- Spin5:Cancel()
- Spin6:Cancel()
- cycled = false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement