View difference between Paste ID: sR41BFMi and dH1PqS81
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",
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 = 10, --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"
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-
local LA,RA = Welds.ArmW.Left,Welds.ArmW.Right
135+
136-
local LL,LR = Welds.LegW.Left,Welds.LegW.Right
136+
137-
local HD = Welds.HeadW.Middle
137+
138-
local LAD = CFrame.new(-1.5,0.5,0)
138+
139-
local RAD = CFrame.new(1.5,0.5,0)
139+
140-
local HDD = CFrame.new(0,-0.8,0)
140+
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
141+
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
142+
143-
Welds.LegW.Left.C1,Welds.LegW.Left.Part0 = CFrame.new(.5,2,0),Torso
143+
144-
Welds.LegW.Right.C1,Welds.LegW.Right.Part0 = CFrame.new(-.5,2,0),Torso 
144+
145-
Welds.HeadW.Middle.C1,Welds.HeadW.Middle.Part0 = CFrame.new(0,-1.5,0),Torso
145+
146-
local _Arm = function(side,tf)
146+
147-
	local Arm = nil
147+
148-
	local Weld = nil
148+
149-
	local RWeld = nil
149+
150-
	for _,S in pairs(Sides) do
150+
151-
		if side:lower() == S:lower() then
151+
152-
			for _,A in pairs(Arms) do
152+
153-
				if A.Name:lower():find(side:lower()) then
153+
154-
					Arm = A
154+
155-
					Weld = Welds.ArmW[S]
155+
156-
					RWeld = RWelds.ArmW[S]
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-
	if Arm and Weld and RWeld then
161+
162-
		if tf then
162+
163-
			Weld.Part1 = Arm
163+
164-
			RWeld.Part1 = nil
164+
165-
		elseif not tf then
165+
166-
			Weld.Part1 = nil
166+
167-
			RWeld.Part1 = Arm
167+
168-
		else
168+
169-
			print("Error")
169+
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-
local _Leg = function(side,tf)
174+
175-
	local Leg = nil
175+
176-
	local Weld = nil
176+
177-
	local RWeld = nil
177+
178-
	for _,S in pairs(Sides) do
178+
179-
		if side:lower() == S:lower() then
179+
180-
			for _,A in pairs(Legs) do
180+
181-
				if A.Name:lower():find(side:lower()) then
181+
182-
					Leg = A
182+
183-
					Weld = Welds.LegW[S]
183+
184-
					RWeld = RWelds.LegW[S]
184+
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-
	if Leg and Weld and RWeld then
189+
190-
		if tf then
190+
191-
			Weld.Part1 = Leg
191+
192-
			RWeld.Part1 = nil
192+
193-
		elseif not tf then
193+
194-
			Weld.Part1 = nil
194+
195-
			RWeld.Part1 = Leg
195+
196-
		else
196+
197-
			print("Error")
197+
198
	end
199
end
200
201
HoverPiece(CFrame.new(0,0,-2.9),CFrame.Angles(0,0,0))
202-
local _Head = function(tf)
202+
203-
	local Head = nil
203+
204-
	local Weld = nil
204+
205-
	local RWeld = nil
205+
206-
	Head = Character["Head"]
206+
207-
	Weld = Welds.HeadW.Middle
207+
208-
	RWeld = RWelds.HeadW.Middle
208+
209-
	if Head and Weld and RWeld then
209+
210-
		if tf then
210+
211-
			Weld.Part1 = Head
211+
212-
			RWeld.Part1 = nil
212+
213-
		elseif not tf then
213+
214-
			Weld.Part1 = nil
214+
215-
			RWeld.Part1 = Head
215+
216-
		else
216+
217-
			print("Error")
217+
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 - 1/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)