Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script:WaitForChild("AT-ST")
- local Engine = script["AT-ST"].Value["Engine"]
- local OriginCF = nil
- local Sitting = false
- local MaxSpeed = 0
- local TurnSpeed = 0
- local TurnRot = 0
- local LastTurnRot = 0
- local Speed = 0
- local SideSpeed = 0
- local Dampening = 1.5
- local MaxPull = 15
- local PullRate = 5
- local Pull = 0
- local TrackStep = 1
- local TrackWaiting = false
- local LastBarrel = 2
- local RocketFireing = false
- local RocketReload = 7
- local Fireing = false
- local Reloading = false
- local FireRate = 0.18
- local MaxAmmo = 50
- local Ammo = MaxAmmo
- local ReloadTime = 7
- local BulletColor = BrickColor.new("Cyan")
- local Gui = nil
- local GunRot = 20
- local MaxGunRot = 20
- local MinGunRot = -40
- local CabinRot = 0
- local MaxCabinRot = 30
- local CabinTurning = false
- local LegsWaiting = false
- local Step = 0
- local RStep = 0
- function GetMovement()
- if script["AT-ST"].Value == nil then
- script:remove()
- elseif script["AT-ST"].Value.Parent == nil then
- script:remove()
- end
- Engine = script["AT-ST"].Value["Engine"]
- local Seat = Engine.Parent.RotBase["GunnerSeat"]
- if Seat.Throttle >= 1 then
- if Speed < MaxSpeed then
- Speed = Speed + 2
- end
- elseif Seat.Throttle <= -1 then
- if Speed > -MaxSpeed then
- Speed = Speed - 2
- end
- elseif Seat.Throttle == 0 then
- if Speed > 0 then
- Speed = Speed - 2
- elseif Speed < 0 then
- Speed = Speed + 2
- else
- Speed = 0
- end
- end
- if Seat.Steer >= 1 then
- TurnRot = TurnRot - TurnSpeed
- elseif Seat.Steer <= -1 then
- TurnRot = TurnRot + TurnSpeed
- elseif Seat.Steer == 0 then
- TurnRot = TurnRot
- LastTurnRot = TurnRot
- end
- if SideSpeed > 0 then
- SideSpeed = SideSpeed - 2
- elseif Speed < 0 then
- SideSpeed = SideSpeed + 2
- else
- SideSpeed = 0
- end
- if Engine["Q"].Value == true then
- if SideSpeed < MaxSpeed then
- SideSpeed = SideSpeed + 2
- end
- elseif Engine["E"].Value == true then
- if SideSpeed > -MaxSpeed then
- SideSpeed = SideSpeed - 2
- end
- elseif Engine["Q"].Value == false and Engine["E"].Value == false then
- if SideSpeed > 0 then
- SideSpeed = SideSpeed - 2
- elseif Speed < 0 then
- SideSpeed = SideSpeed + 2
- end
- end
- local ForwardVector = (Engine.CFrame.lookVector * Speed)
- local SidewaysVector = ((Engine.CFrame * CFrame.Angles(0, math.rad(90), 0)).lookVector * SideSpeed)
- --if Sitting == true then
- --GetAngle()
- --else
- --Engine.Parent["Rotator"]["BodyGyro"].cframe = (OriginCF * CFrame.Angles(0, math.rad(TurnRot), 0))
- --end
- Engine["BodyGyro"].cframe = (OriginCF * CFrame.Angles(0, math.rad(TurnRot), 0))
- Engine["BodyGyro"].maxTorque = Vector3.new(400000, 400000, 400000)
- Engine["BodyVelocity"].velocity = (Engine.CFrame.lookVector * Speed)
- Engine["BodyVelocity"].maxForce = Vector3.new(40000000, 1000, 40000000)
- end
- function GetAngle()
- local MaxDist = (((Engine.CFrame * CFrame.Angles(0, math.rad(MaxCabinRot), 0)) * CFrame.new(0, 0, 1)).p - (Engine.CFrame * CFrame.new(0, 0, 1)).p).magnitude
- local Direction = 0
- local LeftPoint = ((Engine.CFrame * CFrame.Angles(0, math.rad(90), 0)) * CFrame.new(0, 0, 1)).p
- local RightPoint = ((Engine.CFrame * CFrame.Angles(0, math.rad(-90), 0)) * CFrame.new(0, 0, 1)).p
- local Cam = game.Workspace.CurrentCamera
- local CamPos = Cam.CoordinateFrame.p
- local CamFoc = Cam.Focus.p
- local FacingCF = CFrame.new(Vector3.new(CamPos.x, 0, CamPos.z), Vector3.new(CamFoc.x, 0, CamFoc.z))
- local LeftDist = (LeftPoint - (FacingCF * CFrame.new(0, 0, 1)).p).magnitude
- local RightDist = (RightPoint - (FacingCF * CFrame.new(0, 0, 1)).p).magnitude
- if LeftDist < RightDist then
- Direction = 1
- elseif RightDist < LeftDist then
- Direction = -1
- else
- Direction = 0
- end
- local Dist = (LeftPoint - (Engine.CFrame * CFrame.new(0, 0, 1)).p).magnitude
- local AngleCF = nil
- if Dist > MaxDist then
- AngleCF = (Engine.CFrame * CFrame.Angles(0, math.rad(MaxCabinRot * Direction), 0))
- else
- AngleCF = FacingCF
- end
- Engine.Parent["Rotator"]["BodyGyro"].cframe = AngleCF
- end
- function OldGetRotGun()
- if Sitting == true then
- local Mouse = game.Players.LocalPlayer:GetMouse()
- Mouse.TargetFilter = Engine.Parent
- local CameraCF = CFrame.new(Engine.Parent["RotGun"]["Rot"].Position, (CFrame.new(Engine.Parent["RotGun"]["Rot"].Position, Mouse.Hit.p) * CFrame.new(0, 0, -1000)).p)
- local RX, RY, RZ = CameraCF:toEulerAnglesXYZ()
- local EX, EY, EZ = Engine.CFrame:toEulerAnglesXYZ()
- local Rotation = (CameraCF - CameraCF.p)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].cframe = Rotation
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(0, 40000, 0)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].maxTorque = Vector3.new(40000, 0, 40000)
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].cframe = Rotation
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(400, 0, 400)
- else
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(0, 40000, 0)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].maxTorque = Vector3.new(40000, 0, 40000)
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].cframe = Engine.CFrame
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(400, 0, 400)
- end
- end
- function GetRotGun()
- if Sitting == true then
- local Mouse = game.Players.LocalPlayer:GetMouse()
- Mouse.TargetFilter = Engine.Parent
- if (Vector3.new(Mouse.Hit.x, Engine.Position.Y, Mouse.Hit.z) - Engine.Position).magnitude <= 30 and Mouse.Hit.y <= Engine.Parent["RotGun"]["Rot"].Position.Y then
- Engine = Engine
- else
- local CameraCF = CFrame.new(Engine.Parent["RotGun"]["Rot"].Position, (CFrame.new(Engine.Parent["RotGun"]["Rot"].Position, Mouse.Hit.p) * CFrame.new(0, 0, -1000)).p)
- local RX, RY, RZ = CameraCF:toEulerAnglesXYZ()
- local EX, EY, EZ = Engine.CFrame:toEulerAnglesXYZ()
- local Rotation = (CameraCF - CameraCF.p)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].cframe = Rotation
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(0, 40000, 0)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].maxTorque = Vector3.new(40000, 0, 40000)
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].cframe = Rotation
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(400, 0, 400)
- end
- else
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(0, 40000, 0)
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].cframe = Engine.CFrame
- Engine.Parent["RotBase"]["Rot"]["BodyGyro2"].maxTorque = Vector3.new(40000, 0, 40000)
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].cframe = Engine.CFrame
- Engine.Parent["RotGun"]["Rot"]["BodyGyro"].maxTorque = Vector3.new(400, 0, 400)
- end
- end
- function UpdateGui()
- coroutine.resume(coroutine.create(function()
- if Gui == nil then
- if game.Players.LocalPlayer.PlayerGui:findFirstChild("WeaponHud") ~= nil then
- Gui = game.Players.LocalPlayer.PlayerGui["WeaponHud"]
- else
- Gui = script["WeaponHud"]:clone()
- Gui.Parent = game.Players.LocalPlayer.PlayerGui
- for i, v in pairs(Gui:GetChildren()) do
- coroutine.resume(coroutine.create(function()
- v.Visible = true
- end))
- end
- end
- end
- Gui["MainFrame"]["Frame"]["WeaponName"].Text = "Turbolaser"
- if Ammo ~= MaxAmmo then
- Gui["MainFrame"]["Frame"]["BarFrame"]["Bar"].Size = UDim2.new(((1 / MaxAmmo) * (Ammo)), 0, 1, 0)
- else
- Gui["MainFrame"]["Frame"]["BarFrame"]["Bar"].Size = UDim2.new(1, 0, 1, 0)
- --Gui["Bar"]["Fill"].BackgroundColor3 = Color3.new(1, 0, 0)
- end
- local Percent = (((1 / MaxAmmo) * (Ammo)) * 100)
- local PercentText = tostring(Percent)
- if PercentText:sub(1):find(".") and PercentText ~= "100" then
- if Percent < 10 then
- PercentText = PercentText:sub(1, PercentText:sub(1):find("."))
- else
- PercentText = PercentText:sub(1, PercentText:sub(1):find(".") + 1)
- end
- end
- wait(0.1)
- if Reloading == false then
- Gui["MainFrame"]["Frame"]["Percent"].Text = PercentText .. "%"
- else
- Gui["MainFrame"]["Frame"]["Percent"].Text = "RELOADING..."
- end
- end))
- end
- function TestForLightsaber(Human, BulletPos, BulletHitPos)
- local ToReturn = false
- coroutine.resume(coroutine.create(function()
- local LightsaberFound = false
- local FoundLightsaber = nil
- if Human.Parent:findFirstChild("LightsaberEquipped") ~= nil then
- LightsaberFound = true
- FoundLightsaber = Human.Parent["LightsaberEquipped"].Value
- end
- local BlockDist = 0.15
- if LightsaberFound == true then
- if FoundLightsaber:findFirstChild("BlockPrecentage") ~= nil then
- BlockDist = FoundLightsaber["BlockPrecentage"].Value
- else
- BlockDist = 0.15
- end
- end
- if LightsaberFound == true then
- local TheHandle = FoundLightsaber["Handle"]
- local Char = Human.Parent
- local Char2 = game.Players.LocalPlayer.Character
- local LookCF = CFrame.new(Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z), Vector3.new(Char["Torso"].Position.X, BulletPos.y, Char["Torso"].Position.Z))
- local Ray = Ray.new(LookCF.p, (LookCF * CFrame.new(0, 0, -999)).p - LookCF.p)
- local DistFromBullet = (Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z) - Vector3.new(Char2["Torso"].Position.X, BulletPos.y, Char2["Torso"].Position.Z)).magnitude
- local CP = Ray:ClosestPoint(Vector3.new(BulletHitPos.x, BulletPos.y, BulletHitPos.z))
- local DistFromCP = (Vector3.new(BulletHitPos.x, BulletPos.y, BulletHitPos.z) - Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z)).magnitude
- if DistFromCP <= (DistFromBullet * BlockDist) then
- ToReturn = true
- end
- end
- if LightsaberFound == true then
- if FoundLightsaber:findFirstChild("Handle3") then
- local TheHandle = FoundLightsaber["Handle3"]
- local Char = Human.Parent
- local Char2 = game.Players.LocalPlayer.Character
- local LookCF = CFrame.new(Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z), Vector3.new(Char["Torso"].Position.X, BulletPos.y, Char["Torso"].Position.Z))
- local Ray = Ray.new(LookCF.p, (LookCF * CFrame.new(0, 0, -999)).p - LookCF.p)
- local DistFromBullet = (Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z) - Vector3.new(Char2["Torso"].Position.X, BulletPos.y, Char2["Torso"].Position.Z)).magnitude
- local CP = Ray:ClosestPoint(Vector3.new(BulletHitPos.x, BulletPos.y, BulletHitPos.z))
- local DistFromCP = (Vector3.new(BulletHitPos.x, BulletPos.y, BulletHitPos.z) - Vector3.new(TheHandle.Position.X, BulletPos.y, TheHandle.Position.Z)).magnitude
- if DistFromCP <= (DistFromBullet * BlockDist) then
- ToReturn = true
- end
- end
- end
- if (math.random(0, 10) * 0.1) > (BlockDist * 2.25) then
- ToReturn = false
- end
- end))
- return ToReturn
- end
- function FireWeapon(Type)
- coroutine.resume(coroutine.create(function()
- function FireRotGun(TargetPos)
- if Ammo <= 0 or Reloading == true then
- if Reloading == false then
- Reloading = true
- UpdateGui()
- wait(ReloadTime)
- Ammo = MaxAmmo
- Reloading = false
- wait(0.1)
- UpdateGui()
- end
- else
- local Damage = 25
- local DamageRange = 5
- local AccuricyRange = 2
- local TeamKill = false
- local Barrels = {Engine.Parent["RotGun"]["Barrel1"]}
- for i, Barrel in pairs(Barrels) do
- coroutine.resume(coroutine.create(function()
- local BulletsModel = Engine
- local Bullet = Barrel:clone()
- Bullet["PointLight"]:remove()
- Bullet["Flash"]:remove()
- Bullet["Mesh"]:remove()
- Bullet.Name = "Bullet"
- Bullet.Parent = BulletsModel
- Bullet.Anchored = true
- Bullet.CanCollide = false
- Bullet.Material = "Neon"
- Bullet.FormFactor = "Custom"
- Bullet.Transparency = 1
- Bullet.Size = Vector3.new(2, 2, 1)
- local BulletMesh = Instance.new("BlockMesh", Bullet)
- local Bullet2 = Bullet:clone()
- Bullet2.Parent = Bullet.Parent
- local LightPart = Bullet2:clone()
- LightPart.Parent = Bullet2.Parent
- local LightPartLight = Barrel["PointLight"]:clone()
- LightPartLight.Parent = LightPart
- if game.Players.LocalPlayer.Character["Humanoid"].Health > 0 then
- --coroutine.resume(coroutine.create(function()
- if Reloading == false and Ammo > 0 then
- local RotX = (math.random(-(AccuricyRange * 5), (AccuricyRange * 5)) * 0.1)
- local RotY = (math.random(-(AccuricyRange * 5), (AccuricyRange * 5)) * 0.1)
- local DirectionCF = CFrame.new(Barrel.Position, TargetPos) * CFrame.Angles(math.rad(RotX), math.rad(RotY), 0)
- local Dist = 1000
- local Ray = Ray.new(Barrel.Position, (DirectionCF * CFrame.new(0, 0, -1000)).p - Barrel.Position)
- local Hit, Pos = game.Workspace:FindPartOnRay(Ray, game.Players.LocalPlayer.Character)
- if Hit ~= nil then
- Dist = (Pos - Barrel.Position).magnitude
- LightPart.CFrame = (DirectionCF * CFrame.new(0, 0, -(Dist - 1))) * CFrame.Angles(math.rad(-90), 0, 0)
- local Human = nil
- if Hit.Parent:findFirstChild("Humanoid") then
- Human = Hit.Parent["Humanoid"]
- elseif Hit.Parent.Parent:findFirstChild("Humanoid") then
- Human = Hit.Parent.Parent["Humanoid"]
- end
- if Human ~= nil then
- coroutine.resume(coroutine.create(function()
- local BulletBlocked = false
- local BlockedBySaber = TestForLightsaber(Human, DirectionCF.p, Pos)
- if BlockedBySaber == true then
- BulletBlocked = true
- end
- if BulletBlocked == false then
- local EPlayer = game.Players:GetPlayerFromCharacter(Human.Parent)
- local DamageHuman = true
- if EPlayer ~= nil then
- if EPlayer.TeamColor == game.Players.LocalPlayer.TeamColor and TeamKill == false then
- DamageHuman = false
- end
- end
- --wait(0.01)
- if DamageHuman == true and Human.Parent:findFirstChild("ForceField") == nil then
- Human.Health = Human.Health - (math.random((Damage - DamageRange) * 10, (Damage + DamageRange) * 10) * 0.1)
- if Human.Health <= 0 then
- if Human:findFirstChild("creator") == nil then
- local CreatorValue = Instance.new("ObjectValue", Human)
- CreatorValue.Name = "creator"
- CreatorValue.Value = game.Players.LocalPlayer
- end
- end
- end
- end
- end))
- end
- end
- coroutine.resume(coroutine.create(function()
- Bullet.CFrame = DirectionCF
- Bullet2.CFrame = DirectionCF
- Barrel["Fire"]:Play()
- Barrel["PointLight"].Enabled = true
- if BulletColor == nil then
- Bullet.BrickColor = game.Players.LocalPlayer.TeamColor
- else
- Bullet.BrickColor = BulletColor
- end
- Bullet2.BrickColor = BrickColor.new("Institutional white")
- Barrel["PointLight"].Color = Bullet.BrickColor.Color
- LightPartLight.Color = Barrel["PointLight"].Color
- Bullet.Transparency = 0.35
- Bullet2.Transparency = 0.2
- wait(0.03)
- LightPartLight.Enabled = false
- Bullet.Transparency = 1
- Bullet2.Transparency = 1
- Barrel["Flash"]["Flash"].Visible = false
- Barrel["PointLight"].Enabled = false
- Bullet:Destroy()
- Bullet2:Destroy()
- LightPart:Destroy()
- end))
- BulletMesh.Scale = Vector3.new(0.4, 0.4, Dist)
- BulletMesh.Offset = Vector3.new(0, 0, -(Dist / 2))
- Bullet2["Mesh"].Scale = Vector3.new(0.25, 0.25, Dist)
- Bullet2["Mesh"].Offset = Vector3.new(0, 0, -(Dist / 2))
- end
- --end))
- end
- end))
- wait(0.04)
- end
- Ammo = Ammo - 1
- wait(FireRate)
- end
- end
- function Smoke(Missile)
- for i = 1, 5 do
- local Smoke = script["Smoke"]:clone()
- Smoke.Parent = Missile
- Smoke.Size = (math.random(300,400) * 0.01)
- wait(0.01)
- end
- end
- function FireRocket(TargetPos)
- if RocketFireing == true then return end
- RocketFireing = true
- coroutine.resume(coroutine.create(function()
- if game.Players.LocalPlayer.Character["Humanoid"].Health > 0 then
- coroutine.resume(coroutine.create(function()
- local Barrel = Engine.Parent["RotGun"]["RBarrel"]
- local LookCF = CFrame.new(Barrel.Position, TargetPos) * CFrame.Angles(math.rad(2.5), 0, 0)
- local Missile = Instance.new("Part", game.Workspace)
- Missile.Shape = "Ball"
- Missile.Anchored = true
- Missile.CanCollide = false
- Missile.Transparency = 1
- Missile.Size = Vector3.new(1, 1, 1)
- Missile.CFrame = LookCF
- Missile.Velocity = (CFrame.new(Missile.Position, (LookCF * CFrame.new(0, 0, -10)).p).lookVector * 150)
- coroutine.resume(coroutine.create(function()
- Smoke(Missile)
- end))
- wait(0.1)
- Missile.Anchored = false
- script:WaitForChild("Light")
- local Light = script["Light"]:clone()
- Light.Parent = Missile
- local CFValue = Instance.new("CFrameValue", Missile)
- CFValue.Name = "OriginCFrame"
- CFValue.Value = (LookCF * CFrame.new(0, 0, -10))
- local LocalPlayerValue = Instance.new("ObjectValue", Missile)
- LocalPlayerValue.Name = "LocalPlayer"
- LocalPlayerValue.Value = game.Players.LocalPlayer
- local TeamColorValue = Instance.new("BrickColorValue", Missile)
- TeamColorValue.Name = "TeamColor"
- TeamColorValue.Value = game.Players.LocalPlayer.TeamColor
- script:WaitForChild("Effect")
- local Effect = script["Effect"]:clone()
- Effect.Parent = Missile
- Effect.Disabled = false
- end))
- end
- end))
- UpdateGui()
- wait(RocketReload)
- RocketFireing = false
- UpdateGui()
- end
- if Type == "Rocket" then
- local Mouse = game.Players.LocalPlayer:GetMouse()
- FireRocket(Mouse.Hit.p)
- UpdateGui()
- elseif Type == "Bullet" then
- while Fireing == true do
- local Mouse = game.Players.LocalPlayer:GetMouse()
- FireRotGun(Mouse.Hit.p)
- UpdateGui()
- wait(0.02)
- end
- UpdateGui()
- end
- end))
- end
- function Keys()
- local Mouse = nil
- coroutine.resume(coroutine.create(function()
- local NewMouse = game.Players.LocalPlayer:GetMouse()
- if NewMouse ~= Mouse then
- Mouse = NewMouse
- Mouse.KeyDown:connect(function(key)
- if Sitting == true then
- if key == "q" then
- CabinTurning = true
- repeat
- if CabinRot < MaxCabinRot then
- CabinRot = CabinRot + 2
- end
- wait(0.02)
- until CabinTurning == false
- elseif key == "e" then
- CabinTurning = true
- repeat
- if CabinRot > -MaxCabinRot then
- CabinRot = CabinRot - 2
- end
- wait(0.02)
- until CabinTurning == false
- elseif key == "c" then
- CabinRot = 0
- elseif key == "r" then
- if Reloading == false then
- Reloading = true
- UpdateGui()
- wait(ReloadTime)
- Ammo = MaxAmmo
- Reloading = false
- wait(0.1)
- UpdateGui()
- end
- elseif key == "f" then
- if RocketFireing == false then
- FireWeapon("Rocket")
- end
- end
- end
- end)
- Mouse.KeyUp:connect(function(key)
- if Sitting == true then
- if key == "q" then
- CabinTurning = false
- elseif key == "e" then
- CabinTurning = false
- end
- end
- end)
- Mouse.Button1Down:connect(function()
- if Sitting == true then
- Mouse.Button1Up:connect(function()
- Fireing = false
- end)
- Fireing = true
- FireWeapon("Bullet")
- end
- end)
- end
- end))
- end
- Keys()
- function GetHealth()
- local Human = Engine.Parent["Humanoid"]
- if (Human.Health / Human.MaxHealth) <= 0.2 then
- Engine["Smoke"].Enabled = true
- Engine["Smoke"].Opacity = ((1 / (Human.Health / Human.MaxHealth)) * (Human.Health / Human.MaxHealth))
- end
- if Human.Health <= 1 then
- Engine["BodyGyro"].maxTorque = Vector3.new(0, 0, 0)
- Engine["BodyVelocity"].maxForce = Vector3.new(0, 0, 0)
- function Corrode(Item)
- local Waiting = false
- local Waiting2 = false
- for i, v in pairs(Item:GetChildren()) do
- if v:IsA("BasePart") and v.Name ~= "Engine" then
- local Rand = math.random(1,2)
- if Rand == 1 then
- v.Material = "CorrodedMetal"
- v:BreakJoints()
- end
- else
- if v:IsA("Model") then
- Corrode(v)
- end
- end
- if Waiting == false then
- Waiting = true
- if Waiting2 == false then
- Waiting2 = true
- wait(0.01)
- else
- Waiting2 = false
- end
- else
- Waiting = false
- end
- end
- end
- Corrode(Engine.Parent)
- local ex = Instance.new("Explosion", game.Workspace)
- ex.Position = Engine.Position
- ex.BlastRadius = 15
- ex.BlastPressure = 10000
- ex.DestroyJointRadiusPercent = 0
- wait(10)
- coroutine.resume(coroutine.create(function()
- game.Players.LocalPlayer.Character["AT-STVehicle"]:remove()
- end))
- script:remove()
- end
- end
- function Sit(Item)
- local plr = game.Players:GetPlayerFromCharacter(Engine.Parent.Parent.Parent)
- if Item.Name == "SeatWeld" then
- if Item.Part1.Parent:findFirstChild("Humanoid") ~= nil then
- if Item.Part1.Parent["Humanoid"] ~= plr.Character["Humanoid"] then
- --print("NOT ALLOWED!")
- wait(0.1)
- Item.Part1.Parent["Humanoid"].Sit = false
- else
- Sitting = true
- UpdateGui()
- if plr ~= nil then
- Engine.Parent.RotBase["GunnerSeat"].ChildRemoved:connect(function(Item2)
- if Item2 == Item then
- Sitting = false
- if Gui ~= nil then
- Gui:remove()
- Gui = nil
- end
- end
- end)
- end
- end
- end
- end
- end
- Engine.Parent.RotBase["GunnerSeat"].ChildAdded:connect(Sit)
- TurnRot = Engine.Rotation.Y
- OriginCF = Engine.CFrame
- --GetMovement()
- for i, v in pairs(script["WeaponHud"]:GetChildren()) do
- coroutine.resume(coroutine.create(function()
- v.Visible = false
- end))
- end
- local ff = Instance.new("ForceField", Engine.Parent)
- wait(1)
- repeat
- Engine.Parent["Humanoid"].Health = Engine.Parent["Humanoid"].MaxHealth
- wait(0.01)
- until Engine.Parent["Humanoid"].Health == Engine.Parent["Humanoid"].MaxHealth
- ff:remove()
- while true do
- GetMovement()
- GetRotGun()
- GetHealth()
- wait(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement