Advertisement
PierceTheCakeKeeper

Hoverboard thingy FE

May 7th, 2019
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4. -- This script has been converted to FE by iPxter
  5.  
  6.  
  7. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  8. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  9. do
  10. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  11. script.Parent = Player.Character
  12.  
  13. --RemoteEvent for communicating
  14. local Event = Instance.new("RemoteEvent")
  15. Event.Name = "UserInput_Event"
  16.  
  17. --Fake event to make stuff like Mouse.KeyDown work
  18. local function fakeEvent()
  19. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  20. t.connect = t.Connect
  21. return t
  22. end
  23.  
  24. --Creating fake input objects with fake variables
  25. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  26. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  27. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  28. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  29. end}
  30. --Merged 2 functions into one by checking amount of arguments
  31. CAS.UnbindAction = CAS.BindAction
  32.  
  33. --This function will trigger the events that have been :Connect()'ed
  34. local function te(self,ev,...)
  35. local t = m[ev]
  36. if t and t._fakeEvent and t.Function then
  37. t.Function(...)
  38. end
  39. end
  40. m.TrigEvent = te
  41. UIS.TrigEvent = te
  42.  
  43. Event.OnServerEvent:Connect(function(plr,io)
  44. if plr~=Player then return end
  45. if io.isMouse then
  46. m.Target = io.Target
  47. m.Hit = io.Hit
  48. else
  49. local b = io.UserInputState == Enum.UserInputState.Begin
  50. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  51. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  52. end
  53. for _,t in pairs(CAS.Actions) do
  54. for _,k in pairs(t.Keys) do
  55. if k==io.KeyCode then
  56. t.Function(t.Name,io.UserInputState,io)
  57. end
  58. end
  59. end
  60. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  61. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  62. end
  63. end)
  64. Event.Parent = NLS([==[
  65. local Player = game:GetService("Players").LocalPlayer
  66. local Event = script:WaitForChild("UserInput_Event")
  67.  
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76.  
  77. local Mouse = Player:GetMouse()
  78. local h,t
  79. --Give the server mouse data 30 times every second, but only if the values changed
  80. --If player is not moving their mouse, client won't fire events
  81. while wait(1/30) do
  82. if h~=Mouse.Hit or t~=Mouse.Target then
  83. h,t=Mouse.Hit,Mouse.Target
  84. Event:FireServer({isMouse=true,Target=t,Hit=h})
  85. end
  86. end]==],Player.Character)
  87. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  88. end
  89.  
  90.  
  91.  
  92. Colors = {"Royal purple", "Royal purple", "Royal purple", "Royal purple", "Royal Purple", "Royal purple", "Royal purple", "Royal purple", "Royal purple"}
  93. Player = owner
  94. Char = Player.Character
  95. Torso = Char.Torso
  96.  
  97. pcall(function()Char.Platform:Destroy() end)
  98. Main = Instance.new("Model",Char)
  99. Main.Name = "Platform"
  100. script.Parent = Main
  101. Mode = 10
  102. Mode2 = 0
  103. With = 5 -- Must be 5 and larger. Idk why.
  104. Highth = .5
  105. OnColor = 1
  106.  
  107. MainP = Instance.new("Part",Main)
  108. MainP.FormFactor = "Custom"
  109. MainP.Size = Vector3.new(With,Highth,With)
  110. MainP.BrickColor = BrickColor.new(Colors[OnColor])
  111. MainP.Anchored = true
  112. MainP:BreakJoints()
  113. Instance.new("CylinderMesh",MainP)
  114.  
  115. game:GetService("RunService").Stepped:connect(function()
  116. if Mode == 1 then
  117. if Mode2 == 1 then
  118. Torso.CFrame = Torso.CFrame*CFrame.new(0,-.5,0)
  119. elseif Mode2 == 2 then
  120. Torso.CFrame = Torso.CFrame*CFrame.new(0,.5,0)
  121. end
  122. MainP.CFrame = Torso.CFrame * CFrame.new(0,-3+-.225,0)
  123. elseif Mode == 2 then
  124. MainP.CFrame = Torso.CFrame * CFrame.new(5,5,5)
  125. else
  126. Mode = 1
  127. MainP.CFrame = Torso.CFrame * CFrame.new(0,-3+-.225,0)
  128. end
  129. end)
  130.  
  131. LastPart = MainP
  132. Num = 4
  133. game:GetService("RunService").Stepped:connect(function()
  134. local a = OnColor+1
  135. if #Colors < a then
  136. OnColor = 1
  137. else
  138. OnColor = OnColor+1
  139. end
  140. a = MainP:Clone()
  141. a.Mesh.Scale = Vector3.new(.8,.8,.8)
  142. a.Parent = MainP.Parent
  143. a.BrickColor = BrickColor.new(Colors[OnColor])
  144. a.CanCollide = false
  145. aPOS = a.CFrame
  146. coroutine.wrap(function()
  147. for i = 0,1,1/15 do wait()
  148. a.Transparency = i
  149. end
  150. a:Destroy()
  151. end)()
  152. coroutine.wrap(function()
  153. for i = .8,0,.8/-15 do wait()
  154. a.Mesh.Scale = Vector3.new(i,i-.05,i)
  155. end
  156. end)()
  157. end)
  158. local BHold = false
  159. Mouse.KeyDown:connect(function(Key)
  160. if Key == "c" and Mode == 1 then
  161. BHold = true
  162. repeat wait() Mode2 = 1 until BHold == false
  163. Mode2 = 0
  164. elseif Key == "z" and Mode == 1 then
  165. BHold = true
  166. repeat wait() Mode2 = 2 until BHold == false
  167. Mode2 = 0
  168. elseif Key == "p" then
  169. if Mode == 1 then
  170. Mode = 2
  171. coroutine.wrap(function()
  172. while Mode == 2 do
  173. wait()
  174. if Char:GetModelCFrame().p.y < -10 then
  175. Mode = 1
  176. end
  177. end
  178. end)()
  179. else
  180. Mode = 1
  181. end
  182. end
  183. end)
  184. Mouse.KeyUp:connect(function(Key)
  185. if Key == "c" or Key == "z" then
  186. BHold = false
  187. end
  188. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement