Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- NAVAL WARFARE AA SCRIPT --
- -- Sirmeme please unban noam01 from your server plzplz --
- -- Controls: get on a AA turret and watch it destroy the enemy team and make the whole server mad --
- getgenv().AA_enabled = true
- local plr = game.Players.LocalPlayer
- local r = game.ReplicatedStorage.Event
- local BULLETSPEED = 800
- local SHOOTING = false
- local shootThs = {}
- local phrase = "shoot"
- local MAXDIST = 2345 -- Recommended for best performance --
- local function aim(v3)
- r:FireServer("aim",{v3})
- end
- local function shoot(b)
- SHOOTING = b
- for i=1,#shootThs do
- coroutine.resume(shootThs[i])
- end
- end
- local function radar()
- if plr.Character == nil or not plr.Character:FindFirstChild("HumanoidRootPart") or not plr.Character:FindFirstChild("Humanoid") or plr.Character.Humanoid.Health <= 0 then return end
- local team = plr.Team.Name
- local P = plr.Character.HumanoidRootPart.Position
- local r,rv = MAXDIST,nil
- for i,v in next, workspace:GetChildren() do
- if not v:FindFirstChild("HitCode") or not v:FindFirstChild("Team") or not v:FindFirstChild("HP") or not v:FindFirstChild("Seat") then continue end
- if v.HP.Value <= 0 then continue end
- if v.HitCode.Value ~= "Plane" then continue end
- if v.Team.Value == team then continue end
- local d = (P - v.Seat.Position).Magnitude
- if d < r then
- r = d
- rv = v
- end
- end
- return rv
- end
- local function isOnAA()
- if not plr.Character then return false end
- if not plr.Character:FindFirstChild("Humanoid") then return false end
- local seat = plr.Character.Humanoid.SeatPart
- if not seat then return false end
- local hc,gn = seat.Parent:FindFirstChild("HitCode"),seat.Parent:FindFirstChild("GunNum")
- if hc ~= nil and gn ~= nil then
- if hc.Value == "Ship" and gn.Value ~= 0 then phrase = "bomb" return true end
- end
- if seat:FindFirstChild("GunType") ~= nil then
- if seat.GunType.Value == "AA" then phrase = "shoot" return true end
- end
- return false
- end
- local function getShootPos(p,v)
- local from = plr.Character.HumanoidRootPart.Position
- local d = (from - p).Magnitude
- local t = d / (BULLETSPEED - v.Magnitude)
- return p + (v*t)
- end
- local function shootTh()
- while task.wait() do
- if not SHOOTING then
- r:FireServer(phrase,{false})
- coroutine.yield()
- if not SHOOTING then break end
- end
- r:FireServer(phrase,{true})
- end
- end
- for i = 1,1 do
- table.insert(shootThs,coroutine.create(shootTh))
- end
- local tgt = Drawing.new("Circle")
- tgt.Visible = false
- tgt.Color = Color3.new(0,1,0)
- tgt.Radius = 3
- tgt.Thickness = 0
- local tgt2 = Drawing.new("Circle")
- tgt2.Visible = false
- tgt2.Color = Color3.new(0,1,0)
- tgt2.Radius = 15
- tgt2.Thickness = 0
- tgt2.Transparency = 0.25
- local to = Drawing.new("Circle")
- to.Visible = false
- to.Color = Color3.new(1,0,0)
- to.Radius = 3
- to.Thickness = 0
- local to2 = Drawing.new("Circle")
- to2.Visible = false
- to2.Color = Color3.new(1,0,0)
- to2.Radius = 15
- to2.Thickness = 0
- to2.Transparency = 0.25
- local txt = Drawing.new("Text")
- txt.Visible = false
- txt.Font = Drawing.Fonts.Monospace
- txt.Color = Color3.new(1,1,0)
- txt.Size = 14
- txt.Center = true
- txt.Outline = false
- tgt.Filled = true
- tgt2.Filled = true
- to.Filled = true
- to2.Filled = true
- local wasOnAA,hadTarget = false,false
- while AA_enabled do
- task.wait()
- if isOnAA() then
- local target = radar()
- if not target then
- if hadTarget then
- tgt.Visible = false
- tgt2.Visible = false
- to.Visible = false
- to2.Visible = false
- txt.Visible = false
- SHOOTING = false
- end
- hadTarget = false
- continue
- end
- if not hadTarget then
- hadTarget = true
- end
- if not SHOOTING then
- shoot(true)
- end
- local p = target.Seat.Position
- local v = target.Seat.Velocity
- local pos = getShootPos(p,v)
- aim(pos)
- local tgtv3,tgnscreen = workspace.CurrentCamera:WorldToViewportPoint(p)
- local tov3,tonscreen = workspace.CurrentCamera:WorldToViewportPoint(pos)
- local tgtv2,tov2 = Vector2.new(tgtv3.X,tgtv3.Y), Vector2.new(tov3.X,tov3.Y)
- tgt.Position = tgtv2
- tgt2.Position = tgtv2
- txt.Position = tgtv2 - Vector2.new(0,30)
- to.Position = tov2
- to2.Position = tov2
- tgt.Visible = tgnscreen
- tgt2.Visible = tgnscreen
- if tgnscreen then
- txt.Text = ("[%s] HP: %d/%d %dm"):format(target.Name,target.HP.Value, target.Name == "Large Bomber" and 300 or 100, (plr.Character.HumanoidRootPart.Position - target.Seat.Position).Magnitude)
- end
- txt.Visible = tgnscreen
- to.Visible = tonscreen
- to2.Visible = tonscreen
- else
- SHOOTING = false
- tgt.Visible = false
- tgt2.Visible = false
- to.Visible = false
- to2.Visible = false
- txt.Visible = false
- end
- end
- tgt:Remove()
- tgt2:Remove()
- to:Remove()
- to2:Remove()
- txt:Remove()
- shoot(false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement