SHOW:
|
|
- or go back to the newest paste.
| 1 | local Services = setmetatable({},{__index = function(t,i)
| |
| 2 | return game:service(i) or nil | |
| 3 | end}) | |
| 4 | local Player = Services.Players.LocalPlayer | |
| 5 | local Mouse = Player:GetMouse() | |
| 6 | local Character = Player.Character | |
| 7 | local Human = Character:findFirstChild("Humanoid")
| |
| 8 | local Backpack = Player:WaitForChild("Backpack")
| |
| 9 | local Mouse = Player:GetMouse() | |
| 10 | local Count = false | |
| 11 | local Breathing = 1 | |
| 12 | local Transition = false | |
| 13 | local Stance = "Standby" | |
| 14 | ScriptData = {
| |
| 15 | Colors = {
| |
| 16 | Base = "Grey", | |
| 17 | Trim = "White", | |
| 18 | }, | |
| 19 | Surfaces = {
| |
| 20 | "Top", | |
| 21 | "Bottom", | |
| 22 | "Left", | |
| 23 | "Right", | |
| 24 | "Front", | |
| 25 | "Back", | |
| 26 | }, | |
| 27 | Rotation = 0, | |
| 28 | Rotors = {},
| |
| 29 | Keys = {
| |
| 30 | W = false, | |
| 31 | A = false, | |
| 32 | S = false, | |
| 33 | D = false, | |
| 34 | Space = false, | |
| 35 | }, | |
| 36 | - | Lift = 1.3, --Studs off ground |
| 36 | + | Lift = 2.5, --Studs off ground |
| 37 | TurnAngle = 0, | |
| 38 | Last = 0, | |
| 39 | Acceleration = 0, | |
| 40 | } | |
| 41 | ||
| 42 | for _,v in pairs(Character:children()) do | |
| 43 | if v.Name == "Hover" then | |
| 44 | v:Destroy() | |
| 45 | end | |
| 46 | end | |
| 47 | local MainModel = Instance.new("Model",Character)
| |
| 48 | MainModel.Name = "Hover" | |
| 49 | ||
| 50 | local function CreatePart(StringName,ObjectParent,VectorX,VectorY,VectorZ,StringColor,StringMaterial) | |
| 51 | local New_Part = Instance.new("Part",ObjectParent)
| |
| 52 | New_Part.Name = StringName | |
| 53 | New_Part.formFactor = 3 | |
| 54 | New_Part.Anchored = false | |
| 55 | New_Part.CanCollide = false | |
| 56 | New_Part.Locked = true | |
| 57 | New_Part.BrickColor = BrickColor.new(StringColor) | |
| 58 | New_Part.Size = Vector3.new(VectorX,VectorY,VectorZ) | |
| 59 | New_Part.Material = StringMaterial | |
| 60 | for _,S in pairs(ScriptData.Surfaces) do | |
| 61 | New_Part[S.."Surface"] = 10 | |
| 62 | end | |
| 63 | New_Part:BreakJoints() | |
| 64 | Instance.new("BlockMesh",New_Part).Name = "Mesh"
| |
| 65 | return New_Part | |
| 66 | end | |
| 67 | ||
| 68 | local function UD(a,b) | |
| 69 | return UDim2.new(a,0,b,0) | |
| 70 | end | |
| 71 | ||
| 72 | local function Thread(_F) | |
| 73 | return coroutine.resume(coroutine.create(_F)) | |
| 74 | end | |
| 75 | ||
| 76 | local function CreateWeld(StringName,ObjectParent,Part1,Part0,CFrame1,CFrame0) | |
| 77 | local New_Weld = Instance.new("Weld",ObjectParent)
| |
| 78 | New_Weld.Name = StringName | |
| 79 | New_Weld.Part1 = Part1 | |
| 80 | New_Weld.Part0 = Part0 | |
| 81 | New_Weld.C1 = CFrame0 | |
| 82 | New_Weld.C0 = CFrame1 | |
| 83 | return New_Weld | |
| 84 | end | |
| 85 | ||
| 86 | local function lerp(a, b, c) | |
| 87 | return a+(b-a)*c | |
| 88 | end | |
| 89 | ||
| 90 | local function AnimLerp(c1, c2, al) | |
| 91 | local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
| |
| 92 | local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
| |
| 93 | for i,v in pairs(com1) do | |
| 94 | com1[i] = lerp(v,com2[i],al) | |
| 95 | end | |
| 96 | return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1))) | |
| 97 | end | |
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | local Head = Character:findFirstChild("Head")
| |
| 102 | local Torso = Character:findFirstChild("Torso")
| |
| 103 | local Root = Character:findFirstChild("HumanoidRootPart")
| |
| 104 | local MotorHolder = Instance.new("Model",MainModel)
| |
| 105 | MotorHolder.Name = "Motors" | |
| 106 | local Sides = {"Left","Right"}
| |
| 107 | local Arms = {Character["Left Arm"],Character["Right Arm"]}
| |
| 108 | local Legs = {Character["Left Leg"],Character["Right Leg"]}
| |
| 109 | local Welds = {
| |
| 110 | ArmW = {
| |
| 111 | Left = Instance.new("Weld",MotorHolder);
| |
| 112 | Right = Instance.new("Weld",MotorHolder);
| |
| 113 | }; | |
| 114 | LegW = {
| |
| 115 | Left = Instance.new("Weld",MotorHolder);
| |
| 116 | Right = Instance.new("Weld",MotorHolder);
| |
| 117 | }; | |
| 118 | HeadW = {
| |
| 119 | Middle = Instance.new("Weld",MotorHolder);
| |
| 120 | }; | |
| 121 | } | |
| 122 | local RWelds = {
| |
| 123 | ArmW = {
| |
| 124 | Left = Torso["Left Shoulder"]; | |
| 125 | Right = Torso["Right Shoulder"]; | |
| 126 | }; | |
| 127 | LegW = {
| |
| 128 | Left = Torso["Left Hip"]; | |
| 129 | Right = Torso["Right Hip"]; | |
| 130 | }; | |
| 131 | HeadW = {
| |
| 132 | Middle = Torso["Neck"]; | |
| 133 | }; | |
| 134 | } | |
| 135 | ||
| 136 | ||
| 137 | local function Round(Number) | |
| 138 | return math.floor(Number+.5) | |
| 139 | end | |
| 140 | ||
| 141 | --[[Hover Creation]]-- | |
| 142 | local Board = CreatePart("Part",MainModel,1.5,0.25,4,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 143 | local BoardEdge = CreatePart("Part",MainModel,1.505,0.2,3.995,ScriptData.Colors.Trim,"Neon")
| |
| 144 | local BEW = CreateWeld("Weld",BoardEdge,BoardEdge,Board,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
| |
| 145 | -- | |
| 146 | -- | |
| 147 | local PointA = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 148 | PointA.Transparency = 1 | |
| 149 | PointA.CanCollide = false | |
| 150 | local PW = CreateWeld("Weld",PointA,PointA,Board,CFrame.new(0,-0.1,3),CFrame.Angles(math.rad(90),0,0))
| |
| 151 | local PointB = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 152 | PointB.Transparency = 1 | |
| 153 | PointB.CanCollide = false | |
| 154 | local PWB = CreateWeld("Weld",PointB,PointB,Board,CFrame.new(0,-0.1,-3),CFrame.Angles(math.rad(90),0,0))
| |
| 155 | -- | |
| 156 | -- | |
| 157 | local BodyPos = Instance.new("BodyPosition",Board)
| |
| 158 | BodyPos.maxForce = Vector3.new(1e5,1e5,1e5) | |
| 159 | local Tilt = Instance.new("BodyGyro",Board)
| |
| 160 | Tilt.maxTorque = Vector3.new(1,1,1)/0 | |
| 161 | local Push = Instance.new("BodyForce",Board)
| |
| 162 | Push.force = Vector3.new() | |
| 163 | --[[Player Welding]]-- | |
| 164 | ||
| 165 | if Torso and Human and Board then | |
| 166 | Human.PlatformStand = true | |
| 167 | Torso.CFrame = Torso.CFrame*CFrame.new(0,2,0) | |
| 168 | local TtBW = CreateWeld("Weld",Torso,Torso,Board,CFrame.new(0,3,0),CFrame.Angles(0,math.rad(90),0))
| |
| 169 | end | |
| 170 | ||
| 171 | local function HoverPiece(CF,CFA) | |
| 172 | local Center = CreatePart("Part",MainModel,0.4,0.2,0.4,"Black","SmoothPlastic")
| |
| 173 | Center:ClearAllChildren() | |
| 174 | Instance.new("CylinderMesh",Center).Scale = Vector3.new(1,1,1)
| |
| 175 | local Emitter = Instance.new("ParticleEmitter", Center)
| |
| 176 | Emitter.Enabled = true | |
| 177 | Emitter.Name = "Realism" | |
| 178 | Emitter.Acceleration = Vector3.new(0.5,0.5,0.5) | |
| 179 | Emitter.Transparency = NumberSequence.new(0.5,0.8) | |
| 180 | Emitter.Rate = NumberRange.new(1) | |
| 181 | local PW1 = CreateWeld("Weld",Center,Center,Board,CF,CFA)
| |
| 182 | local Spin = Center:Clone() | |
| 183 | Spin.Parent = MainModel | |
| 184 | Spin.Size = Vector3.new(1,1,1) | |
| 185 | Spin.Transparency = 1 | |
| 186 | local SPW = CreateWeld("Weld",Spin,Spin,Center,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
| |
| 187 | table.insert(ScriptData.Rotors, SPW) | |
| 188 | for i=0,360,45 do | |
| 189 | local Part = CreatePart("Part",MainModel,1,0.25,0.25,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 190 | local PW2 = CreateWeld("Weld",Part,Part,Center,CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,1.08),CFrame.Angles(0,0,0))
| |
| 191 | local Edge = CreatePart("Part",MainModel,1,0.2,0.2,ScriptData.Colors.Trim,"Neon")
| |
| 192 | local EW = CreateWeld("Weld",Edge,Edge,Part,CFrame.new(0,0,0.05),CFrame.Angles(0,0,0))
| |
| 193 | end | |
| 194 | for i=0,360,45 do | |
| 195 | local Rotor = CreatePart("Part",MainModel,2,0.2,0.25,"White","SmoothPlastic")
| |
| 196 | Rotor:findFirstChild("Mesh").Scale = Vector3.new(1,0.125,1)
| |
| 197 | local RW = CreateWeld("Weld",Rotor,Rotor,Spin,CFrame.Angles(0,math.rad(i),0)*CFrame.new(0,0,0.2),CFrame.Angles(math.rad(-20),0,0))
| |
| 198 | end | |
| 199 | end | |
| 200 | ||
| 201 | HoverPiece(CFrame.new(0,0,-2.9),CFrame.Angles(0,0,0)) | |
| 202 | HoverPiece(CFrame.new(0,0,2.9),CFrame.Angles(0,0,0)) | |
| 203 | ||
| 204 | Services.RunService.Stepped:connect(function() | |
| 205 | pcall(function() | |
| 206 | for _,v in pairs(ScriptData.Rotors) do | |
| 207 | if v and v.Parent then | |
| 208 | v.C0 = v.C0 * CFrame.Angles(0,math.rad(10),0) | |
| 209 | end | |
| 210 | end | |
| 211 | end) | |
| 212 | a,b = ypcall(function() | |
| 213 | if Board and Torso and BodyPos and Tilt and PointA and PointB then | |
| 214 | local Rays = Ray.new(PointA.CFrame.p,PointA.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0))) | |
| 215 | local Object,Pos = Services.Workspace:findPartOnRay(Rays,Character) | |
| 216 | local Rays2 = Ray.new(PointB.CFrame.p,PointB.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0))) | |
| 217 | local Object2,Pos2 = Services.Workspace:findPartOnRay(Rays2,Character) | |
| 218 | local Left,Right,Front,Back,Space,Accept = 0,0,0,0,0,0 | |
| 219 | local Face = Board.CFrame.lookVector | |
| 220 | ||
| 221 | if ScriptData.Keys.A==true then | |
| 222 | Left = 1 | |
| 223 | elseif ScriptData.Keys.D==true then | |
| 224 | Right = -1 | |
| 225 | end | |
| 226 | if ScriptData.Keys.Space==true then | |
| 227 | Space = 5 | |
| 228 | else | |
| 229 | Space = 0 | |
| 230 | end | |
| 231 | if ScriptData.Keys.S==true then | |
| 232 | Back,ScriptData.Last = -2,-1 | |
| 233 | ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1 | |
| 234 | elseif ScriptData.Keys.W==true then | |
| 235 | Front,ScriptData.Last = 2,1 | |
| 236 | ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1 | |
| 237 | elseif ScriptData.Acceleration ~= 0 and not ScriptData.Keys.S==true and not ScriptData.Keys.W==true then | |
| 238 | ScriptData.Acceleration = ScriptData.Acceleration>0 and ScriptData.Acceleration - 0.1 or 0 | |
| 239 | Accept = ScriptData.Last | |
| 240 | end | |
| 241 | ||
| 242 | ScriptData.TurnAngle = ScriptData.TurnAngle - math.pi*(Left+Right)/32 | |
| 243 | Tilt.cframe = CFrame.new()*CFrame.Angles(0,-ScriptData.TurnAngle,((Left+Right)/2))*CFrame.Angles(-((Front+Back)/5),0,0) | |
| 244 | ||
| 245 | if Object and Object:IsA("BasePart") or Object2 and Object2:IsA("BasePart") then
| |
| 246 | local A = 0 | |
| 247 | local B = 0 | |
| 248 | ||
| 249 | if Object then | |
| 250 | A = Object.CFrame.Y + Object.Size.Y/2 | |
| 251 | end | |
| 252 | if Object2 then | |
| 253 | B = Object2.CFrame.Y + Object2.Size.Y/2 | |
| 254 | end | |
| 255 | BodyPos.maxForce = Vector3.new(1e5,1e5,1e5) | |
| 256 | BodyPos.position = Vector3.new(Board.CFrame.X,(((A+B)/2)+ScriptData.Lift)+Space,Board.CFrame.Z) + Vector3.new(Face.X,0,Face.Z)*ScriptData.Acceleration*(Front+Back+Accept) | |
| 257 | else | |
| 258 | BodyPos.maxForce = Vector3.new(1e5,0,1e5) | |
| 259 | BodyPos.position = Vector3.new(Board.CFrame.X,Board.CFrame.Y,Board.CFrame.Z) + Vector3.new(Face.X,Space,Face.Z)*ScriptData.Acceleration*(Front+Back+Accept) | |
| 260 | end | |
| 261 | end | |
| 262 | end) | |
| 263 | if not a then | |
| 264 | print("E: "..b)
| |
| 265 | end | |
| 266 | end) | |
| 267 | ||
| 268 | Thread(function() | |
| 269 | while true do | |
| 270 | for i = 0,10,0.1 do | |
| 271 | ScriptData.Lift = ScriptData.Lift + (math.sin(math.pi*2/10*i)*0.1) | |
| 272 | wait(0.02) | |
| 273 | end | |
| 274 | end | |
| 275 | end) | |
| 276 | ||
| 277 | Mouse.KeyDown:connect(function(Key) | |
| 278 | if Key == "w" then | |
| 279 | ScriptData.Keys.W = true | |
| 280 | end | |
| 281 | if Key == "a" then | |
| 282 | ScriptData.Keys.A = true | |
| 283 | end | |
| 284 | if Key == "s" then | |
| 285 | ScriptData.Keys.S = true | |
| 286 | end | |
| 287 | if Key == "d" then | |
| 288 | ScriptData.Keys.D = true | |
| 289 | end | |
| 290 | if Key:byte() == 32 then | |
| 291 | ScriptData.Keys.Space = true | |
| 292 | end | |
| 293 | end) | |
| 294 | ||
| 295 | Mouse.KeyUp:connect(function(Key) | |
| 296 | if Key == "w" then | |
| 297 | ScriptData.Keys.W = false | |
| 298 | end | |
| 299 | if Key == "a" then | |
| 300 | ScriptData.Keys.A = false | |
| 301 | end | |
| 302 | if Key == "s" then | |
| 303 | ScriptData.Keys.S = false | |
| 304 | end | |
| 305 | if Key == "d" then | |
| 306 | ScriptData.Keys.D = false | |
| 307 | end | |
| 308 | if Key:byte() == 32 then | |
| 309 | ScriptData.Keys.Space = false | |
| 310 | end | |
| 311 | end) | |
| 312 | ||
| 313 | _Arm("Left", true)
| |
| 314 | _Arm("Right", true)
| |
| 315 | _Leg("Left", true)
| |
| 316 | _Leg("Right", true)
| |
| 317 | _Head(true) | |
| 318 | ||
| 319 | Services.RunService.RenderStepped:connect(function() | |
| 320 | if Transition then | |
| 321 | if Breathing >= 1 then | |
| 322 | Transition = false | |
| 323 | end | |
| 324 | Breathing = Breathing + 1/100 | |
| 325 | else | |
| 326 | if Breathing <= 0 then | |
| 327 | Transition = true | |
| 328 | end | |
| 329 | Breathing = Breathing - 0/100 | |
| 330 | end | |
| 331 | ||
| 332 | if Stance == "None" then | |
| 333 | LA.C0 = LAD * CFrame.Angles(math.rad(10*Breathing),0,math.rad(-20)) | |
| 334 | RA.C0 = RAD * CFrame.Angles(math.rad(-10*Breathing),0,math.rad(20)) | |
| 335 | LL.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(-5)) | |
| 336 | LR.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(5)) | |
| 337 | end | |
| 338 | end) |