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 = 0 | |
| 12 | local Transition = false | |
| 13 | local Stance = "Standby" | |
| 14 | ScriptData = {
| |
| 15 | Colors = {
| |
| 16 | - | Base = "Grey", |
| 16 | + | Base = "Really black", |
| 17 | - | Trim = "White", |
| 17 | + | Trim = "Burnt Sienna", |
| 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 = 2, --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 | local Stance = "None" | |
| 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 | local LA,RA = Welds.ArmW.Left,Welds.ArmW.Right | |
| 136 | local LL,LR = Welds.LegW.Left,Welds.LegW.Right | |
| 137 | local HD = Welds.HeadW.Middle | |
| 138 | local LAD = CFrame.new(-1.5,0.5,0) | |
| 139 | local RAD = CFrame.new(1.5,0.5,0) | |
| 140 | local HDD = CFrame.new(0,-0.8,0) | |
| 141 | Welds.ArmW.Left.C1,Welds.ArmW.Left.C0,Welds.ArmW.Left.Part0 = CFrame.new(0, 0.5, 0),CFrame.new(-1.5, 0.5, 0),Torso | |
| 142 | Welds.ArmW.Right.C1,Welds.ArmW.Right.C0,Welds.ArmW.Right.Part0 = CFrame.new(0, 0.5, 0),CFrame.new(1.5, 0.5, 0),Torso | |
| 143 | Welds.LegW.Left.C1,Welds.LegW.Left.Part0 = CFrame.new(.5,2,0),Torso | |
| 144 | Welds.LegW.Right.C1,Welds.LegW.Right.Part0 = CFrame.new(-.5,2,0),Torso | |
| 145 | Welds.HeadW.Middle.C1,Welds.HeadW.Middle.Part0 = CFrame.new(0,-1.5,0),Torso | |
| 146 | local _Arm = function(side,tf) | |
| 147 | local Arm = nil | |
| 148 | local Weld = nil | |
| 149 | local RWeld = nil | |
| 150 | for _,S in pairs(Sides) do | |
| 151 | if side:lower() == S:lower() then | |
| 152 | for _,A in pairs(Arms) do | |
| 153 | if A.Name:lower():find(side:lower()) then | |
| 154 | Arm = A | |
| 155 | Weld = Welds.ArmW[S] | |
| 156 | RWeld = RWelds.ArmW[S] | |
| 157 | end | |
| 158 | end | |
| 159 | end | |
| 160 | end | |
| 161 | if Arm and Weld and RWeld then | |
| 162 | if tf then | |
| 163 | Weld.Part1 = Arm | |
| 164 | RWeld.Part1 = nil | |
| 165 | elseif not tf then | |
| 166 | Weld.Part1 = nil | |
| 167 | RWeld.Part1 = Arm | |
| 168 | else | |
| 169 | print("Error")
| |
| 170 | end | |
| 171 | end | |
| 172 | end | |
| 173 | ||
| 174 | local _Leg = function(side,tf) | |
| 175 | local Leg = nil | |
| 176 | local Weld = nil | |
| 177 | local RWeld = nil | |
| 178 | for _,S in pairs(Sides) do | |
| 179 | if side:lower() == S:lower() then | |
| 180 | for _,A in pairs(Legs) do | |
| 181 | if A.Name:lower():find(side:lower()) then | |
| 182 | Leg = A | |
| 183 | Weld = Welds.LegW[S] | |
| 184 | RWeld = RWelds.LegW[S] | |
| 185 | end | |
| 186 | end | |
| 187 | end | |
| 188 | end | |
| 189 | if Leg and Weld and RWeld then | |
| 190 | if tf then | |
| 191 | Weld.Part1 = Leg | |
| 192 | RWeld.Part1 = nil | |
| 193 | elseif not tf then | |
| 194 | Weld.Part1 = nil | |
| 195 | RWeld.Part1 = Leg | |
| 196 | else | |
| 197 | print("Error")
| |
| 198 | end | |
| 199 | end | |
| 200 | end | |
| 201 | ||
| 202 | local _Head = function(tf) | |
| 203 | local Head = nil | |
| 204 | local Weld = nil | |
| 205 | local RWeld = nil | |
| 206 | Head = Character["Head"] | |
| 207 | Weld = Welds.HeadW.Middle | |
| 208 | RWeld = RWelds.HeadW.Middle | |
| 209 | if Head and Weld and RWeld then | |
| 210 | if tf then | |
| 211 | Weld.Part1 = Head | |
| 212 | RWeld.Part1 = nil | |
| 213 | elseif not tf then | |
| 214 | Weld.Part1 = nil | |
| 215 | RWeld.Part1 = Head | |
| 216 | else | |
| 217 | print("Error")
| |
| 218 | end | |
| 219 | end | |
| 220 | end | |
| 221 | ||
| 222 | local function Round(Number) | |
| 223 | return math.floor(Number+.5) | |
| 224 | end | |
| 225 | ||
| 226 | --[[Hover Creation]]-- | |
| 227 | local Board = CreatePart("Part",MainModel,1.5,0.25,4,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 228 | local BoardEdge = CreatePart("Part",MainModel,1.505,0.2,3.995,ScriptData.Colors.Trim,"Neon")
| |
| 229 | local BEW = CreateWeld("Weld",BoardEdge,BoardEdge,Board,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
| |
| 230 | -- | |
| 231 | -- | |
| 232 | local PointA = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 233 | PointA.Transparency = 1 | |
| 234 | PointA.CanCollide = false | |
| 235 | local PW = CreateWeld("Weld",PointA,PointA,Board,CFrame.new(0,-0.1,3),CFrame.Angles(math.rad(90),0,0))
| |
| 236 | local PointB = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 237 | PointB.Transparency = 1 | |
| 238 | PointB.CanCollide = false | |
| 239 | local PWB = CreateWeld("Weld",PointB,PointB,Board,CFrame.new(0,-0.1,-3),CFrame.Angles(math.rad(90),0,0))
| |
| 240 | -- | |
| 241 | -- | |
| 242 | local BodyPos = Instance.new("BodyPosition",Board)
| |
| 243 | BodyPos.maxForce = Vector3.new(1e5,1e5,1e5) | |
| 244 | local Tilt = Instance.new("BodyGyro",Board)
| |
| 245 | Tilt.maxTorque = Vector3.new(1,1,1)/0 | |
| 246 | local Push = Instance.new("BodyForce",Board)
| |
| 247 | Push.force = Vector3.new() | |
| 248 | --[[Player Welding]]-- | |
| 249 | ||
| 250 | if Torso and Human and Board then | |
| 251 | Human.PlatformStand = true | |
| 252 | Torso.CFrame = Torso.CFrame*CFrame.new(0,2,0) | |
| 253 | local TtBW = CreateWeld("Weld",Torso,Torso,Board,CFrame.new(0,3,0),CFrame.Angles(0,math.rad(90),0))
| |
| 254 | end | |
| 255 | ||
| 256 | local function HoverPiece(CF,CFA) | |
| 257 | local Center = CreatePart("Part",MainModel,0.4,0.2,0.4,"Black","SmoothPlastic")
| |
| 258 | Center:ClearAllChildren() | |
| 259 | Instance.new("CylinderMesh",Center).Scale = Vector3.new(1,1,1)
| |
| 260 | local Emitter = Instance.new("ParticleEmitter", Center)
| |
| 261 | Emitter.Enabled = true | |
| 262 | Emitter.Name = "Realism" | |
| 263 | Emitter.Acceleration = Vector3.new(0.5,0.5,0.5) | |
| 264 | Emitter.Transparency = NumberSequence.new(0.5,0.8) | |
| 265 | Emitter.Rate = NumberRange.new(1) | |
| 266 | local PW1 = CreateWeld("Weld",Center,Center,Board,CF,CFA)
| |
| 267 | local Spin = Center:Clone() | |
| 268 | Spin.Parent = MainModel | |
| 269 | Spin.Size = Vector3.new(1,1,1) | |
| 270 | Spin.Transparency = 1 | |
| 271 | local SPW = CreateWeld("Weld",Spin,Spin,Center,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
| |
| 272 | table.insert(ScriptData.Rotors, SPW) | |
| 273 | for i=0,360,45 do | |
| 274 | local Part = CreatePart("Part",MainModel,1,0.25,0.25,ScriptData.Colors.Base,"SmoothPlastic")
| |
| 275 | 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))
| |
| 276 | local Edge = CreatePart("Part",MainModel,1,0.2,0.2,ScriptData.Colors.Trim,"Neon")
| |
| 277 | local EW = CreateWeld("Weld",Edge,Edge,Part,CFrame.new(0,0,0.05),CFrame.Angles(0,0,0))
| |
| 278 | end | |
| 279 | for i=0,360,45 do | |
| 280 | - | local Rotor = CreatePart("Part",MainModel,2,0.2,0.25,"White","SmoothPlastic")
|
| 280 | + | local Rotor = CreatePart("Part",MainModel,2,0.2,0.25,"Burnt Sienna","SmoothPlastic")
|
| 281 | Rotor:findFirstChild("Mesh").Scale = Vector3.new(1,0.125,1)
| |
| 282 | 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))
| |
| 283 | end | |
| 284 | end | |
| 285 | ||
| 286 | HoverPiece(CFrame.new(0,0,-2.9),CFrame.Angles(0,0,0)) | |
| 287 | HoverPiece(CFrame.new(0,0,2.9),CFrame.Angles(0,0,0)) | |
| 288 | ||
| 289 | Services.RunService.Stepped:connect(function() | |
| 290 | pcall(function() | |
| 291 | for _,v in pairs(ScriptData.Rotors) do | |
| 292 | if v and v.Parent then | |
| 293 | v.C0 = v.C0 * CFrame.Angles(0,math.rad(10),0) | |
| 294 | end | |
| 295 | end | |
| 296 | end) | |
| 297 | a,b = ypcall(function() | |
| 298 | if Board and Torso and BodyPos and Tilt and PointA and PointB then | |
| 299 | local Rays = Ray.new(PointA.CFrame.p,PointA.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0))) | |
| 300 | local Object,Pos = Services.Workspace:findPartOnRay(Rays,Character) | |
| 301 | local Rays2 = Ray.new(PointB.CFrame.p,PointB.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0))) | |
| 302 | local Object2,Pos2 = Services.Workspace:findPartOnRay(Rays2,Character) | |
| 303 | local Left,Right,Front,Back,Space,Accept = 0,0,0,0,0,0 | |
| 304 | local Face = Board.CFrame.lookVector | |
| 305 | ||
| 306 | if ScriptData.Keys.A==true then | |
| 307 | Left = 1 | |
| 308 | elseif ScriptData.Keys.D==true then | |
| 309 | Right = -1 | |
| 310 | end | |
| 311 | if ScriptData.Keys.Space==true then | |
| 312 | Space = 5 | |
| 313 | else | |
| 314 | Space = 0 | |
| 315 | end | |
| 316 | if ScriptData.Keys.S==true then | |
| 317 | Back,ScriptData.Last = -2,-1 | |
| 318 | ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1 | |
| 319 | elseif ScriptData.Keys.W==true then | |
| 320 | Front,ScriptData.Last = 2,1 | |
| 321 | ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1 | |
| 322 | elseif ScriptData.Acceleration ~= 0 and not ScriptData.Keys.S==true and not ScriptData.Keys.W==true then | |
| 323 | ScriptData.Acceleration = ScriptData.Acceleration>0 and ScriptData.Acceleration - 0.1 or 0 | |
| 324 | Accept = ScriptData.Last | |
| 325 | end | |
| 326 | ||
| 327 | ScriptData.TurnAngle = ScriptData.TurnAngle - math.pi*(Left+Right)/32 | |
| 328 | Tilt.cframe = CFrame.new()*CFrame.Angles(0,-ScriptData.TurnAngle,((Left+Right)/2))*CFrame.Angles(-((Front+Back)/5),0,0) | |
| 329 | ||
| 330 | if Object and Object:IsA("BasePart") or Object2 and Object2:IsA("BasePart") then
| |
| 331 | local A = 0 | |
| 332 | local B = 0 | |
| 333 | ||
| 334 | if Object then | |
| 335 | A = Object.CFrame.Y + Object.Size.Y/2 | |
| 336 | end | |
| 337 | if Object2 then | |
| 338 | B = Object2.CFrame.Y + Object2.Size.Y/2 | |
| 339 | end | |
| 340 | BodyPos.maxForce = Vector3.new(1e5,1e5,1e5) | |
| 341 | 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) | |
| 342 | else | |
| 343 | BodyPos.maxForce = Vector3.new(1e5,0,1e5) | |
| 344 | 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) | |
| 345 | end | |
| 346 | end | |
| 347 | end) | |
| 348 | if not a then | |
| 349 | print("E: "..b)
| |
| 350 | end | |
| 351 | end) | |
| 352 | ||
| 353 | Thread(function() | |
| 354 | while true do | |
| 355 | for i = 0,10,0.1 do | |
| 356 | ScriptData.Lift = ScriptData.Lift + (math.sin(math.pi*2/10*i)*0.1) | |
| 357 | wait(0.02) | |
| 358 | end | |
| 359 | end | |
| 360 | end) | |
| 361 | ||
| 362 | Mouse.KeyDown:connect(function(Key) | |
| 363 | if Key == "w" then | |
| 364 | ScriptData.Keys.W = true | |
| 365 | end | |
| 366 | if Key == "a" then | |
| 367 | ScriptData.Keys.A = true | |
| 368 | end | |
| 369 | if Key == "s" then | |
| 370 | ScriptData.Keys.S = true | |
| 371 | end | |
| 372 | if Key == "d" then | |
| 373 | ScriptData.Keys.D = true | |
| 374 | end | |
| 375 | if Key:byte() == 32 then | |
| 376 | ScriptData.Keys.Space = true | |
| 377 | end | |
| 378 | end) | |
| 379 | ||
| 380 | Mouse.KeyUp:connect(function(Key) | |
| 381 | if Key == "w" then | |
| 382 | ScriptData.Keys.W = false | |
| 383 | end | |
| 384 | if Key == "a" then | |
| 385 | ScriptData.Keys.A = false | |
| 386 | end | |
| 387 | if Key == "s" then | |
| 388 | ScriptData.Keys.S = false | |
| 389 | end | |
| 390 | if Key == "d" then | |
| 391 | ScriptData.Keys.D = false | |
| 392 | end | |
| 393 | if Key:byte() == 32 then | |
| 394 | ScriptData.Keys.Space = false | |
| 395 | end | |
| 396 | end) | |
| 397 | ||
| 398 | _Arm("Left", true)
| |
| 399 | _Arm("Right", true)
| |
| 400 | _Leg("Left", true)
| |
| 401 | _Leg("Right", true)
| |
| 402 | _Head(true) | |
| 403 | ||
| 404 | Services.RunService.RenderStepped:connect(function() | |
| 405 | if Transition then | |
| 406 | if Breathing >= 1 then | |
| 407 | Transition = false | |
| 408 | end | |
| 409 | Breathing = Breathing + 1/100 | |
| 410 | else | |
| 411 | if Breathing <= 0 then | |
| 412 | Transition = true | |
| 413 | end | |
| 414 | Breathing = Breathing - 1/100 | |
| 415 | end | |
| 416 | ||
| 417 | if Stance == "None" then | |
| 418 | LA.C0 = LAD * CFrame.Angles(math.rad(10*Breathing),0,math.rad(-20)) | |
| 419 | RA.C0 = RAD * CFrame.Angles(math.rad(-10*Breathing),0,math.rad(20)) | |
| 420 | LL.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(-5)) | |
| 421 | LR.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(5)) | |
| 422 | end | |
| 423 | end) |