View difference between Paste ID: bVdWmkEH and 5EFnBx0V
SHOW: | | - or go back to the newest paste.
1
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,game,owner = owner,game
4
local RealPlayer = Player
5
do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end
6
7
local Services = setmetatable({},{__index = function(t,i)
8
    return game:service(i) or nil
9
end})
10
local Player = Services.Players.LocalPlayer
11
local Mouse = Player:GetMouse()
12
local Character = Player.Character
13
local Human = Character:findFirstChild("Humanoid")
14
local Backpack = Player:WaitForChild("Backpack")
15
local Mouse = Player:GetMouse()
16
local Count = false
17
local Breathing = 0
18
local Transition = false
19
local Stance = "Standby"
20
ScriptData = {
21
	Colors = {
22
		Base = "Grey",
23
		Trim = "White",
24
	},
25
	Surfaces = {
26
		"Top",
27
		"Bottom",
28
		"Left",
29
		"Right",
30
		"Front",
31
		"Back",
32
	},
33
	Rotation = 0,
34
	Rotors = {},
35
	Keys = {
36
		W = false,
37
		A = false,
38
		S = false,
39
		D = false,
40
		Space = false,
41
	},
42
	Lift = 2, --Studs off ground
43
	TurnAngle = 0,
44
	Last = 0,
45
	Acceleration = 0,
46
}
47
48
for _,v in pairs(Character:children()) do
49
	if v.Name == "Hover" then
50
		v:Destroy()
51
	end
52
end
53
local MainModel = Instance.new("Model",Character)
54
MainModel.Name = "Hover"
55
56
local function CreatePart(StringName,ObjectParent,VectorX,VectorY,VectorZ,StringColor,StringMaterial)
57
	local New_Part = Instance.new("Part",ObjectParent)
58
	New_Part.Name = StringName
59
	New_Part.formFactor = 3
60
	New_Part.Anchored = false
61
	New_Part.CanCollide = false
62
	New_Part.Locked = true
63
	New_Part.BrickColor = BrickColor.new(StringColor)
64
	New_Part.Size = Vector3.new(VectorX,VectorY,VectorZ)
65
	New_Part.Material = StringMaterial
66
	for _,S in pairs(ScriptData.Surfaces) do
67
		New_Part[S.."Surface"] = 10
68
	end
69
	New_Part:BreakJoints()
70
	Instance.new("BlockMesh",New_Part).Name = "Mesh"
71
	return New_Part
72
end
73
74
local function UD(a,b)
75
	return UDim2.new(a,0,b,0)
76
end
77
78
local function Thread(_F)
79
	return coroutine.resume(coroutine.create(_F))
80
end
81
82
local function CreateWeld(StringName,ObjectParent,Part1,Part0,CFrame1,CFrame0)
83
	local New_Weld = Instance.new("Weld",ObjectParent)
84
	New_Weld.Name = StringName
85
	New_Weld.Part1 = Part1
86
	New_Weld.Part0 = Part0
87
	New_Weld.C1 = CFrame0
88
	New_Weld.C0 = CFrame1
89
	return New_Weld
90
end
91
92
local function lerp(a, b, c)
93
    return a+(b-a)*c
94
end
95
96
local function AnimLerp(c1, c2, al)
97
    local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
98
    local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
99
    for i,v in pairs(com1) do 
100
    	com1[i] = lerp(v,com2[i],al) 
101
   	end
102
    return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
103
end
104
105
local Stance = "None"
106
107
local Head = Character:findFirstChild("Head")
108
local Torso = Character:findFirstChild("Torso")
109
local Root = Character:findFirstChild("HumanoidRootPart")
110
local MotorHolder = Instance.new("Model",MainModel)
111
MotorHolder.Name = "Motors"
112
local Sides = {"Left","Right"}
113
local Arms = {Character["Left Arm"],Character["Right Arm"]}
114
local Legs = {Character["Left Leg"],Character["Right Leg"]}
115
local Welds = {
116
	ArmW = {
117
		Left = Instance.new("Weld",MotorHolder);
118
		Right = Instance.new("Weld",MotorHolder);
119
	};
120
	LegW = {
121
		Left = Instance.new("Weld",MotorHolder);
122
		Right = Instance.new("Weld",MotorHolder);
123
	};
124
	HeadW = {
125
		Middle = Instance.new("Weld",MotorHolder);
126
	};
127
}
128
local RWelds = {
129
	ArmW = {
130
		Left = Torso["Left Shoulder"];
131
		Right = Torso["Right Shoulder"];
132
	};
133
	LegW = {
134
		Left = Torso["Left Hip"];
135
		Right = Torso["Right Hip"];
136
	};
137
	HeadW = {
138
		Middle = Torso["Neck"];
139
	};
140
}
141
local LA,RA = Welds.ArmW.Left,Welds.ArmW.Right
142
local LL,LR = Welds.LegW.Left,Welds.LegW.Right
143
local HD = Welds.HeadW.Middle
144
local LAD = CFrame.new(-1.5,0.5,0)
145
local RAD = CFrame.new(1.5,0.5,0)
146
local HDD = CFrame.new(0,-0.8,0)
147
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
148
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
149
Welds.LegW.Left.C1,Welds.LegW.Left.Part0 = CFrame.new(.5,2,0),Torso
150
Welds.LegW.Right.C1,Welds.LegW.Right.Part0 = CFrame.new(-.5,2,0),Torso 
151
Welds.HeadW.Middle.C1,Welds.HeadW.Middle.Part0 = CFrame.new(0,-1.5,0),Torso
152
local _Arm = function(side,tf)
153
	local Arm = nil
154
	local Weld = nil
155
	local RWeld = nil
156
	for _,S in pairs(Sides) do
157
		if side:lower() == S:lower() then
158
			for _,A in pairs(Arms) do
159
				if A.Name:lower():find(side:lower()) then
160
					Arm = A
161
					Weld = Welds.ArmW[S]
162
					RWeld = RWelds.ArmW[S]
163
				end
164
			end
165
		end
166
	end
167
	if Arm and Weld and RWeld then
168
		if tf then
169
			Weld.Part1 = Arm
170
			RWeld.Part1 = nil
171
		elseif not tf then
172
			Weld.Part1 = nil
173
			RWeld.Part1 = Arm
174
		else
175
			print("Error")
176
		end
177
	end
178
end
179
180
local _Leg = function(side,tf)
181
	local Leg = nil
182
	local Weld = nil
183
	local RWeld = nil
184
	for _,S in pairs(Sides) do
185
		if side:lower() == S:lower() then
186
			for _,A in pairs(Legs) do
187
				if A.Name:lower():find(side:lower()) then
188
					Leg = A
189
					Weld = Welds.LegW[S]
190
					RWeld = RWelds.LegW[S]
191
				end
192
			end
193
		end
194
	end
195
	if Leg and Weld and RWeld then
196
		if tf then
197
			Weld.Part1 = Leg
198
			RWeld.Part1 = nil
199
		elseif not tf then
200
			Weld.Part1 = nil
201
			RWeld.Part1 = Leg
202
		else
203
			print("Error")
204
		end
205
	end
206
end
207
208
local _Head = function(tf)
209
	local Head = nil
210
	local Weld = nil
211
	local RWeld = nil
212
	Head = Character["Head"]
213
	Weld = Welds.HeadW.Middle
214
	RWeld = RWelds.HeadW.Middle
215
	if Head and Weld and RWeld then
216
		if tf then
217
			Weld.Part1 = Head
218
			RWeld.Part1 = nil
219
		elseif not tf then
220
			Weld.Part1 = nil
221
			RWeld.Part1 = Head
222
		else
223
			print("Error")
224
		end
225
	end
226
end
227
228
local function Round(Number)
229
	return math.floor(Number+.5)
230
end
231
232
--[[Hover Creation]]--
233
local Board = CreatePart("Part",MainModel,1.5,0.25,4,ScriptData.Colors.Base,"SmoothPlastic")
234
local BoardEdge = CreatePart("Part",MainModel,1.505,0.2,3.995,ScriptData.Colors.Trim,"Neon")
235
local BEW = CreateWeld("Weld",BoardEdge,BoardEdge,Board,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
236
--
237
--
238
local PointA = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
239
PointA.Transparency = 1
240
PointA.CanCollide = false
241
local PW = CreateWeld("Weld",PointA,PointA,Board,CFrame.new(0,-0.1,3),CFrame.Angles(math.rad(90),0,0))
242
local PointB = CreatePart("Part",MainModel,0.2,0.2,0.2,ScriptData.Colors.Base,"SmoothPlastic")
243
PointB.Transparency = 1
244
PointB.CanCollide = false
245
local PWB = CreateWeld("Weld",PointB,PointB,Board,CFrame.new(0,-0.1,-3),CFrame.Angles(math.rad(90),0,0))
246
--
247
--
248
local BodyPos = Instance.new("BodyPosition",Board)
249
BodyPos.maxForce = Vector3.new(1e5,1e5,1e5)
250
local Tilt = Instance.new("BodyGyro",Board)
251
Tilt.maxTorque = Vector3.new(1,1,1)/0
252
local Push = Instance.new("BodyForce",Board)
253
Push.force = Vector3.new()
254
--[[Player Welding]]--
255
256
if Torso and Human and Board then
257
	Human.PlatformStand = true
258
	Torso.CFrame = Torso.CFrame*CFrame.new(0,2,0)
259
	local TtBW = CreateWeld("Weld",Torso,Torso,Board,CFrame.new(0,3,0),CFrame.Angles(0,math.rad(90),0))
260
end
261
262
local function HoverPiece(CF,CFA)
263
	local Center = CreatePart("Part",MainModel,0.4,0.2,0.4,"Black","SmoothPlastic")
264
	Center:ClearAllChildren()
265
	Instance.new("CylinderMesh",Center).Scale = Vector3.new(1,1,1)
266
	local Emitter = Instance.new("ParticleEmitter", Center)
267
	Emitter.Enabled = true
268
	Emitter.Name = "Realism"
269
	Emitter.Acceleration = Vector3.new(0.5,0.5,0.5)
270
	Emitter.Transparency = NumberSequence.new(0.5,0.8)
271
	Emitter.Rate = NumberRange.new(1)
272
	local PW1 = CreateWeld("Weld",Center,Center,Board,CF,CFA)
273
	local Spin = Center:Clone()
274
	Spin.Parent = MainModel
275
	Spin.Size = Vector3.new(1,1,1)
276
	Spin.Transparency = 1
277
	local SPW = CreateWeld("Weld",Spin,Spin,Center,CFrame.new(0,0,0),CFrame.Angles(0,0,0))
278
	table.insert(ScriptData.Rotors, SPW)
279
	for i=0,360,45 do
280
		local Part = CreatePart("Part",MainModel,1,0.25,0.25,ScriptData.Colors.Base,"SmoothPlastic")
281
		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))
282
		local Edge = CreatePart("Part",MainModel,1,0.2,0.2,ScriptData.Colors.Trim,"Neon")
283
		local EW = CreateWeld("Weld",Edge,Edge,Part,CFrame.new(0,0,0.05),CFrame.Angles(0,0,0))
284
	end
285
	for i=0,360,45 do
286
		local Rotor = CreatePart("Part",MainModel,2,0.2,0.25,"White","SmoothPlastic")
287
		Rotor:findFirstChild("Mesh").Scale = Vector3.new(1,0.125,1)
288
		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))
289
	end
290
end
291
292
HoverPiece(CFrame.new(0,0,-2.9),CFrame.Angles(0,0,0))
293
HoverPiece(CFrame.new(0,0,2.9),CFrame.Angles(0,0,0))
294
295
Services.RunService.Stepped:connect(function()
296
	pcall(function()
297
		for _,v in pairs(ScriptData.Rotors) do
298
			if v and v.Parent then
299
				v.C0 = v.C0 * CFrame.Angles(0,math.rad(10),0)
300
			end
301
		end
302
	end)
303
	a,b = ypcall(function()
304
		if Board and Torso and BodyPos and Tilt and PointA and PointB then
305
			local Rays = Ray.new(PointA.CFrame.p,PointA.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0)))
306
			local Object,Pos = Services.Workspace:findPartOnRay(Rays,Character)
307
			local Rays2 = Ray.new(PointB.CFrame.p,PointB.CFrame.lookVector*(ScriptData.Lift + 4 + (ScriptData.Keys.Space==true and 5 or 0)))
308
			local Object2,Pos2 = Services.Workspace:findPartOnRay(Rays2,Character)
309
			local Left,Right,Front,Back,Space,Accept = 0,0,0,0,0,0
310
			local Face = Board.CFrame.lookVector
311
312
			if ScriptData.Keys.A==true then
313
				Left = 1
314
			elseif ScriptData.Keys.D==true then
315
				Right = -1
316
			end
317
			if ScriptData.Keys.Space==true then
318
				Space = 5
319
			else
320
				Space = 0
321
			end
322
			if ScriptData.Keys.S==true then
323
				Back,ScriptData.Last = -2,-1
324
				ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1
325
			elseif ScriptData.Keys.W==true then
326
				Front,ScriptData.Last = 2,1
327
				ScriptData.Acceleration = ScriptData.Acceleration >=8 and 8 or ScriptData.Acceleration + 0.1
328
			elseif ScriptData.Acceleration ~= 0 and not ScriptData.Keys.S==true and not ScriptData.Keys.W==true then
329
				ScriptData.Acceleration = ScriptData.Acceleration>0 and ScriptData.Acceleration - 0.1 or 0
330
				Accept = ScriptData.Last
331
			end
332
333
			ScriptData.TurnAngle = ScriptData.TurnAngle - math.pi*(Left+Right)/32
334
			Tilt.cframe = CFrame.new()*CFrame.Angles(0,-ScriptData.TurnAngle,((Left+Right)/2))*CFrame.Angles(-((Front+Back)/5),0,0)
335
336
			if Object and Object:IsA("BasePart") or Object2 and Object2:IsA("BasePart") then
337
				local A = 0
338
				local B = 0
339
340
				if Object then
341
					A = Object.CFrame.Y + Object.Size.Y/2
342
				end
343
				if Object2 then
344
					B = Object2.CFrame.Y + Object2.Size.Y/2
345
				end
346
				BodyPos.maxForce = Vector3.new(1e5,1e5,1e5)
347
				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)
348
			else
349
				BodyPos.maxForce = Vector3.new(1e5,0,1e5)
350
				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)
351
			end
352
		end
353
	end)
354
	if not a then
355
		print("E: "..b)
356
	end
357
end)
358
359
Thread(function()
360
	while true do
361
		for i = 0,10,0.1 do
362
			ScriptData.Lift = ScriptData.Lift + (math.sin(math.pi*2/10*i)*0.1)
363
			wait(0.02)
364
		end 
365
	end
366
end)
367
368
Mouse.KeyDown:connect(function(Key)
369
	if Key == "w" then
370
		ScriptData.Keys.W = true
371
	end
372
	if Key == "a" then
373
		ScriptData.Keys.A = true
374
	end
375
	if Key == "s" then
376
		ScriptData.Keys.S = true
377
	end
378
	if Key == "d" then
379
		ScriptData.Keys.D = true
380
	end
381
	if Key:byte() == 32 then
382
		ScriptData.Keys.Space = true
383
	end
384
end)
385
386
Mouse.KeyUp:connect(function(Key)
387
	if Key == "w" then
388
		ScriptData.Keys.W = false
389
	end
390
	if Key == "a" then
391
		ScriptData.Keys.A = false
392
	end
393
	if Key == "s" then
394
		ScriptData.Keys.S = false
395
	end
396
	if Key == "d" then
397
		ScriptData.Keys.D = false
398
	end
399
	if Key:byte() == 32 then
400
		ScriptData.Keys.Space = false
401
	end
402
end)
403
404
_Arm("Left", true)
405
_Arm("Right", true)
406
_Leg("Left", true)
407
_Leg("Right", true)
408
_Head(true)
409
410
Services.RunService.RenderStepped:connect(function()
411
	if Transition then
412
		if Breathing >= 1 then
413
			Transition = false
414
		end
415
		Breathing = Breathing + 1/100
416
	else
417
		if Breathing <= 0 then
418
			Transition = true
419
		end
420
		Breathing = Breathing - 1/100
421
	end
422
423
	if Stance == "None" then
424
		LA.C0 = LAD * CFrame.Angles(math.rad(10*Breathing),0,math.rad(-20))
425
		RA.C0 = RAD * CFrame.Angles(math.rad(-10*Breathing),0,math.rad(20))
426
		LL.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(-5))
427
		LR.C0 = CFrame.new() * CFrame.Angles(0,0,math.rad(5))
428
	end
429
end)