Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if game.Workspace:FindFirstChild("SevenUFO") ~= nil then
- game.Workspace.SevenUFO:Destroy()
- end
- if game.Players.LocalPlayer.Backpack:FindFirstChild("UFOTool") ~= nil then
- game.Players.LocalPlayer.Backpack.UFOTool:Destroy()
- end
- local SPAWN_UFO = game:GetObjects('rbxassetid://289807596')[1]
- SPAWN_UFO.Parent = game.Workspace
- SPAWN_UFO:MoveTo(game.Players.LocalPlayer.Character.Torso.Position)
- SPAWN_UFO:MakeJoints()
- local Flying = false
- local Player = game.Players.LocalPlayer
- local Mouse = Player:GetMouse()
- local UFO = game.Workspace.SevenUFO
- local UFOSeat = game.Workspace.SevenUFO.VehicleSeat
- local BIN = Instance.new("HopperBin", Player.Backpack)
- BIN.Name = "UFOTool"
- local LeftCannon = UFO.LeftCannon
- local RightCannon = UFO.RightCannon
- game.Workspace.SevenUFO:WaitForChild("VehicleSeat")
- local Speed = 0
- local Keys = {w = false, s = false, a = false, d = false}
- local E1
- local E2
- local function start()
- if UFOSeat:FindFirstChild("BodyPosition") ~= nil then
- UFOSeat.BodyPosition:Destroy()
- end
- if UFOSeat:FindFirstChild("BodyGyro") ~= nil then
- UFOSeat.BodyGyro:Destroy()
- end
- local POS = Instance.new("BodyPosition", UFOSeat)
- local GYRO = Instance.new("BodyGyro", UFOSeat)
- POS.maxForce = Vector3.new(math.huge, math.huge, math.huge)
- POS.position = UFOSeat.Position
- GYRO.maxTorque = Vector3.new(9e9, 9e9, 9e9)
- GYRO.cframe = UFOSeat.CFrame
- repeat
- wait()
- local NEW = GYRO.CFrame - GYRO.CFrame.p + POS.position
- if not Keys.w and not Keys.s and not Keys.a and not Keys.d then
- Speed = 1
- end
- if Keys.w then
- NEW = NEW + game.Workspace.CurrentCamera.CoordinateFrame.lookVector * Speed
- Speed = Speed + 0.01
- end
- if Keys.s then
- NEW = NEW - game.Workspace.CurrentCamera.CoordinateFrame.lookVector * Speed
- Speed = Speed + 0.01
- end
- if Keys.a then
- NEW = NEW * CFrame.new(-Speed,0,0)
- Speed = Speed + 0.01
- end
- if Keys.d then
- NEW = NEW * CFrame.new(Speed,0,0)
- Speed = Speed + 0.01
- end
- if Speed > 5 then
- Speed = 5
- end
- POS.Position = NEW.p
- if Keys.w then
- GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad(Speed * 15),0,0)
- elseif Keys.s then
- GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(math.rad(Speed * 15),0,0)
- else
- GYRO.cframe = game.Workspace.CurrentCamera.CoordinateFrame
- end
- until Flying == false
- if GYRO then
- GYRO:Destroy()
- end
- if POS then
- POS:Destroy()
- end
- Flying = false
- Speed = 0
- end
- E1 = Mouse.KeyDown:connect(function(Key)
- if not UFOSeat or not UFOSeat.Parent then
- Flying = false
- E1:disconnect()
- E2:disconnect()
- return
- end
- if Key == "w" then
- Keys.w = true
- elseif Key == "s" then
- Keys.s = true
- elseif Key == "a" then
- Keys.a = true
- elseif Key == "d" then
- Keys.d = true
- elseif Key == "e" then
- if Flying == true then
- Flying = false
- else
- Flying = true
- start()
- end
- end
- end)
- E2 = Mouse.KeyUp:connect(function(Key)
- if Key == "w" then
- Keys.w = false
- elseif Key == "s" then
- Keys.s = false
- elseif Key == "a" then
- Keys.a = false
- elseif Key == "d" then
- Keys.d = false
- end
- end)
- start()
- BIN.Selected:connect(function ()
- Mouse.Button1Down:connect(function (Select)
- local LeftLaser = Instance.new("Part", LeftCannon)
- LeftLaser.Name = "LeftLaser"
- LeftLaser.FormFactor = "Custom"
- LeftLaser.Size = Vector3.new(1,1,1)
- local LeftSide = LeftCannon.CFrame
- local LeftMesh = Instance.new("BlockMesh", LeftLaser)
- LeftMesh.Scale = Vector3.new(1,1,(LeftSide.p - Mouse.Hit.p).magnitude)
- LeftLaser.CFrame = CFrame.new((LeftSide.p + Mouse.Hit.p)/2, LeftSide.p)
- LeftLaser.Color = Color3.new(1,0,0)
- LeftLaser.Anchored = true
- LeftLaser.CanCollide = false
- LeftLaser.Material = "Neon"
- local RightLaser = Instance.new("Part", RightCannon)
- RightLaser.Name = "RightLaser"
- RightLaser.FormFactor = "Custom"
- RightLaser.Size = Vector3.new(1,1,1)
- local LeftSide = LeftCannon.CFrame
- local RightSide = RightCannon.CFrame
- local RightMesh = Instance.new("BlockMesh", RightLaser)
- RightMesh.Scale = Vector3.new(1,1,(RightSide.p - Mouse.Hit.p).magnitude)
- RightLaser.CFrame = CFrame.new((RightSide.p + Mouse.Hit.p)/2, RightSide.p)
- RightLaser.Color = Color3.new(1,0,0)
- RightLaser.Anchored = true
- RightLaser.CanCollide = false
- RightLaser.Material = "Neon"
- local Explosion = Instance.new("Explosion", game.Workspace)
- Explosion.Position = Mouse.Hit.p
- Explosion.BlastRadius = 20
- for i = 1, 10 do
- LeftLaser.Transparency = 0.5 + (i * 0.05)
- RightLaser.Transparency = 0.5 + (i * 0.05)
- wait(0.1)
- end
- LeftLaser:Destroy()
- RightLaser:Destroy()
- end)
- end)
Add Comment
Please, Sign In to add comment