Advertisement
DaOMEGAa32

fe nyan cat

May 14th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.67 KB | None | 0 0
  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
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152.  
  153. -- Go to line 5 and change it to your name. LOCAL SCRIPT!!!!!
  154.  
  155.  
  156. Rainbow = {"Bright red", "Neon orange", "Bright yellow", "Lime green", "Deep blue", "Bright violet"}
  157. me = game.Players.LocalPlayer
  158. function Part(P, Anch, Coll, Tran, Ref, Col, Size, Name)
  159. local p = Instance.new("Part")
  160. p.TopSurface = 0
  161. p.BottomSurface = 0
  162. p.Transparency = Tran
  163. p.Reflectance = Ref
  164. p.CanCollide = Coll
  165. p.Anchored = Anch
  166. p.BrickColor = BrickColor.new(Col)
  167. p.formFactor = "Custom"
  168. p.Size = Size
  169. if Name then p.Name = Name end
  170. p.Parent = P
  171. p.Locked = true
  172. p:BreakJoints()
  173. return p
  174. end
  175. V3 = Vector3.new
  176. CN = CFrame.new
  177. CA = CFrame.Angles
  178. MR = math.rad
  179. MRA = math.random
  180. function Weld(P0, P1, CF1, CF2, Name)
  181. local w = Instance.new("Motor6D")
  182. w.Part0 = P0
  183. w.Part1 = P1
  184. w.C0 = CF1
  185. w.C1 = CF2
  186. if Name then w.Name = Name end
  187. w.Parent = P0
  188. return w
  189. end
  190. function MakeNyan(Player, S)
  191. local Naim = "Nyan "..Player.Name:sub(1,5)
  192. if S >= 5 then Naim = "Giant Nyan "..Player.Name:sub(1,5) end
  193. local Model = Instance.new("Model")
  194. Model.Name = Naim
  195. local Torso = Part(Model, false, false, 0, 0, "Brick yellow", V3(0.5*S, 1.5*S, 2*S), "Torso")
  196. local Head = Part(Model, false, false, 0, 0, "Dark grey", V3(0.6*S, 0.8*S, 1.2*S), "Head")
  197. Instance.new("BlockMesh",Head)
  198. local Neck = Weld(Torso, Head, CN(0, -0.35*S, -0.9*S), CN(), "Neck")
  199. local Tart = Part(Model, false, false, 0, 0, "Pink", V3(0.5*S+0.05, 1.2*S, 1.7*S), "Torso")
  200. Instance.new("BlockMesh",Tart)
  201. Weld(Torso, Tart, CN(), CN())
  202. local RFL = Part(Model, false, false, 0, 0, "Dark grey", V3(0.4*S, 0.6*S, 0.4*S), "Right Arm")
  203. Instance.new("SpecialMesh",RFL).MeshType = "Sphere"
  204. local LFL = Part(Model, false, false, 0, 0, "Dark grey", V3(0.4*S, 0.6*S, 0.4*S), "Left Arm")
  205. Instance.new("SpecialMesh",LFL).MeshType = "Sphere"
  206. local RBL = Part(Model, false, false, 0, 0, "Dark grey", V3(0.4*S, 0.6*S, 0.4*S), "Right Leg")
  207. Instance.new("SpecialMesh",RBL).MeshType = "Sphere"
  208. local LBL = Part(Model, false, false, 0, 0, "Dark grey", V3(0.4*S, 0.6*S, 0.4*S), "Left Leg")
  209. Instance.new("SpecialMesh",LBL).MeshType = "Sphere"
  210. local RSH = Weld(Torso, RFL, CN(), CN(-0.1*S, 0.8*S, 0.8*S), "Right Shoulder")
  211. local LSH = Weld(Torso, LFL, CN(), CN(0.1*S, 0.8*S, 0.6*S), "Left Shoulder")
  212. local RH = Weld(Torso, RBL, CN(), CN(-0.1*S, 0.8*S, -0.8*S), "Right Hip")
  213. local LH = Weld(Torso, LBL, CN(), CN(0.1*S, 0.8*S, -1*S), "Left Hip")
  214. local Mouth = Part(Model, false, false, 0, 0, "Really black", V3(0.6*S+0.05, 0.2*S, 0.6*S))
  215. Weld(Head, Mouth, CN(0, -0.25*S, -0.1), CN())
  216. Instance.new("BlockMesh",Mouth).Scale = V3(1, 0.6, 0.8)
  217. for i = -0.25, 0.25, 0.25 do
  218. local Mouth2 = Part(Model, false, false, 0, 0, "Really black", V3(0.6*S+0.05, 0.3*S, 0.2*S))
  219. Weld(Mouth, Mouth2, CN(0, 0.1*S, i*S), CN())
  220. Instance.new("BlockMesh",Mouth2).Scale = V3(1, 0.6, 0.6)
  221. end
  222. local Nose = Part(Model, false, false, 0, 0, "Really black", V3(0.6*S+0.05, 0.2*S, 0.2*S))
  223. Weld(Head, Nose, CN(0, 0.05*S, -0.1*S), CN())
  224. Instance.new("BlockMesh",Nose).Scale = V3(1, 0.6, 0.6)
  225. for i = -0.3, 0.31, 0.6 do
  226. local Eye = Part(Model, false, false, 0, 0, "Really black", V3(0.6*S+0.05, 0.3*S, 0.3*S))
  227. Weld(Head, Eye, CN(0, 0.15*S, (i-0.1)*S), CN())
  228. local Eye2 = Part(Model, false, false, 0, 0, "Institutional white", V3(0.6*S+0.1, 0.2*S, 0.2*S))
  229. Weld(Eye, Eye2, CN(0, 0.04*S, 0.04*S), CN())
  230. Instance.new("BlockMesh",Eye).Scale = V3(1, 0.6, 0.6)
  231. Instance.new("BlockMesh",Eye2).Scale = V3(1, 0.4, 0.4)
  232. end
  233. for i = -0.4, 0.5, 0.9 do
  234. local Cheek = Part(Model, false, false, 0, 0, "Medium red", V3(0.6*S+0.05, 0.2*S, 0.2*S))
  235. Instance.new("BlockMesh",Cheek).Scale = V3(1, 0.8, 0.8)
  236. Weld(Head, Cheek, CN(0, -0.05*S, (i-0.1)*S), CN())
  237. end
  238. for i = -80, -140, -20 do
  239. local tail = Part(Model, false, false, 0, 0, "Dark grey", V3(0.4*S, 0.25*S, 0.3*S))
  240. Weld(Torso, tail, CN(0, 0.2*S, 1.15*S) * CA(MR(i), 0, 0), CN(0, 0, 0.5*S))
  241. Instance.new("BlockMesh",tail)
  242. end
  243. for i = 0, 180, 180 do
  244. local ear = Part(Model, false, false, 0, 0, "Dark grey", V3(0.6*S, 0.4*S, 0.5*S))
  245. Instance.new("SpecialMesh",ear).MeshType = "Wedge"
  246. Weld(Head, ear, CN(0, 0.45*S, 0) * CA(0, MR(i), 0), CN(0, 0, -0.32*S) * CA(MR(15), 0, 0))
  247. end
  248. local Hum = Instance.new("Humanoid")
  249. Hum.Name = "Humanoid"
  250. Hum.MaxHealth = 100
  251. Hum.Health = 100
  252. Hum.WalkSpeed = 11+(5*S)
  253. Hum.Parent = Model
  254. Model.Parent = workspace
  255. Model:MakeJoints()
  256. Model:MoveTo(V3(0, 2*S, 0))
  257. Player.Character = Model
  258. local lastP = (Torso.CFrame * CN(0, 0, 0.9*S)).p
  259. local function runn()
  260. for i = 0.5, 1, 0.5 do
  261. RSH.C0 = CN(0, -(0.2*S)*i, 0)
  262. LSH.C0 = CN(0, -(0.2*S)*i, 0)
  263. RH.C0 = CN(0, -(0.2*S)*i, 0)
  264. LH.C0 = CN(0, -(0.2*S)*i, 0)
  265. wait()
  266. end
  267. for i = 0.5, 1, 0.5 do
  268. RSH.C0 = CN(0, -(0.2*S), (0.2*S)*i)
  269. LSH.C0 = CN(0, -(0.2*S), (0.2*S)*i)
  270. RH.C0 = CN(0, -(0.2*S), (0.2*S)*i)
  271. LH.C0 = CN(0, -(0.2*S), (0.2*S)*i)
  272. wait()
  273. end
  274. for i = 0.5, 1, 0.5 do
  275. RSH.C0 = CN(0, -(0.2*S)+(0.2*S)*i, (0.2*S))
  276. LSH.C0 = CN(0, -(0.2*S)+(0.2*S)*i, (0.2*S))
  277. RH.C0 = CN(0, -(0.2*S)+(0.2*S)*i, (0.2*S))
  278. LH.C0 = CN(0, -(0.2*S)+(0.2*S)*i, (0.2*S))
  279. wait()
  280. end
  281. for i = 0.5, 1, 0.5 do
  282. RSH.C0 = CN(0, 0, (0.2*S)-(0.2*S)*i)
  283. LSH.C0 = CN(0, 0, (0.2*S)-(0.2*S)*i)
  284. RH.C0 = CN(0, 0, (0.2*S)-(0.2*S)*i)
  285. LH.C0 = CN(0, 0, (0.2*S)-(0.2*S)*i)
  286. wait()
  287. end
  288. end
  289. local poss = "Standing"
  290. coroutine.resume(coroutine.create(function()
  291. while Player.Character == Model do
  292. wait(0.1)
  293. if poss == "Running" then
  294. runn()
  295. end
  296. end
  297. end))
  298. coroutine.resume(coroutine.create(function()
  299. while Player.Character == Model do
  300. wait(0.1)
  301. local speed = Torso.Velocity.magnitude
  302. local posnow = (Torso.CFrame * CN(0, 0, 0.9*S)).p
  303. coroutine.resume(coroutine.create(function()
  304. if speed > 2 then
  305. poss = "Running"
  306. local ps = {}
  307. for i,v in pairs(Rainbow) do
  308. local a = (#Rainbow-i)
  309. a = ((a-(a/2))/2.5)*S
  310. local pp = Part(Model, true, false, 0, 0, v, V3(0.2, 0.2, 0.2), "Rainbow")
  311. local dist = (posnow - lastP).magnitude
  312. Instance.new("BlockMesh",pp).Scale = V3(1, ((1.4*S)/#Rainbow)*5, dist*5)
  313. pp.CFrame = CN(lastP, posnow) * CN(0, a, -dist/2)
  314. table.insert(ps, pp)
  315. end
  316. coroutine.resume(coroutine.create(function()
  317. wait(10)
  318. for i = 0, 1, 0.2 do
  319. wait()
  320. for _,v in pairs(ps) do
  321. v.Transparency = i
  322. end
  323. end
  324. for _,v in pairs(ps) do
  325. v:remove()
  326. end
  327. end))
  328. else poss = "Standing" end
  329. end))
  330. lastP = posnow
  331. end
  332. end))
  333. end
  334. for i,v in pairs(game.Players:GetPlayers()) do
  335. MakeNyan(v, MRA(10,120)/10)
  336. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement