Advertisement
TheRealNNej

KeyDown:connect(function(key)

Jul 21st, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.27 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  5. script.Parent = Player.Character
  6.  
  7. --RemoteEvent for communicating
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local function fakeEvent()
  13. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14. t.connect = t.Connect
  15. return t
  16. end
  17.  
  18. --Creating fake input objects with fake variables
  19. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23. end}
  24. --Merged 2 functions into one by checking amount of arguments
  25. CAS.UnbindAction = CAS.BindAction
  26.  
  27. --This function will trigger the events that have been :Connect()'ed
  28. local function te(self,ev,...)
  29. local t = m[ev]
  30. if t and t._fakeEvent and t.Function then
  31. t.Function(...)
  32. end
  33. end
  34. m.TrigEvent = te
  35. UIS.TrigEvent = te
  36.  
  37. Event.OnServerEvent:Connect(function(plr,io)
  38. if plr~=Player then return end
  39. if io.isMouse then
  40. m.Target = io.Target
  41. m.Hit = io.Hit
  42. else
  43. local b = io.UserInputState == Enum.UserInputState.Begin
  44. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46. end
  47. for _,t in pairs(CAS.Actions) do
  48. for _,k in pairs(t.Keys) do
  49. if k==io.KeyCode then
  50. t.Function(t.Name,io.UserInputState,io)
  51. end
  52. end
  53. end
  54. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56. end
  57. end)
  58. Event.Parent = NLS([==[
  59. local Player = game:GetService("Players").LocalPlayer
  60. local Event = script:WaitForChild("UserInput_Event")
  61.  
  62. local UIS = game:GetService("UserInputService")
  63. local input = function(io,a)
  64. if a then return end
  65. --Since InputObject is a client-side instance, we create and pass table instead
  66. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67. end
  68. UIS.InputBegan:Connect(input)
  69. UIS.InputEnded:Connect(input)
  70.  
  71. local Mouse = Player:GetMouse()
  72. local h,t
  73. --Give the server mouse data 30 times every second, but only if the values changed
  74. --If player is not moving their mouse, client won't fire events
  75. while wait(1/30) do
  76. if h~=Mouse.Hit or t~=Mouse.Target then
  77. h,t=Mouse.Hit,Mouse.Target
  78. Event:FireServer({isMouse=true,Target=t,Hit=h})
  79. end
  80. end]==],Player.Character)
  81. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83.  
  84. print('Guitar')
  85. print('By slenercat5')
  86. print('F to toggle Camera perspectives')--FANCY :D
  87. Player=owner
  88. Character=Player.Character
  89. Character.Animate.Disabled=true
  90. local LeftArm = Character["Left Arm"]
  91. local RightArm = Character["Right Arm"]
  92. local LeftLeg = Character["Left Leg"]
  93. local RightLeg = Character["Right Leg"]
  94. local Head = Character.Head
  95. local Torso = Character.Torso
  96. local Camera = game.Workspace.CurrentCamera
  97. local RootPart = Character.HumanoidRootPart
  98. local RootJoint = RootPart.RootJoint
  99. local Humanoid=Character.Humanoid
  100. CAM=Camera
  101. FF=Instance.new('ForceField',Character)
  102. FF.Visible=false
  103. Humanoid.Name='LOLOL YOU CANT HIT ME'
  104. Character.
  105. Health:remove()
  106. for i,v in pairs (Humanoid:GetPlayingAnimationTracks()) do
  107. v:Stop()
  108. end
  109.  
  110. local newMotor = function(part0, part1, c0, c1)
  111. w = Instance.new('Motor')
  112. w.Parent = part0
  113. w.Part0 = part0
  114. w.Part1 = part1
  115. w.C0 = c0
  116. w.C1 = c1
  117.  
  118. return w
  119. end
  120.  
  121.  
  122.  
  123.  
  124. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  125. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  126.  
  127. local RW = newMotor(Torso, RightArm, CFrame.new(2.5, 0, 0), CFrame.new(0, 0, 0))
  128. local LW = newMotor(Torso, LeftArm, CFrame.new(-2.5, 0, 0), CFrame.new(0, 0, 0))
  129. local RH = newMotor(Torso, RightLeg, CFrame.new(1.5, -3, 0), CFrame.new(0, 0, 0))
  130. local LH = newMotor(Torso, LeftLeg, CFrame.new(-1.5, -3, 0), CFrame.new(0, 0, 0))
  131. RootJoint.C1 = CFrame.new(0, 0, 0)
  132. RootJoint.C0 = CFrame.new(0, 0, 0)
  133. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  134. Torso.Neck.C0 = CFrame.new(0, 2.5, 0)
  135.  
  136. local rarmc1 = RW.C1
  137. local larmc1 = LW.C1
  138. local rlegc1 = RH.C1
  139. local llegc1 = LH.C1
  140.  
  141. local resetc1 = false
  142.  
  143. function clerp(a, b, t)
  144. return a:lerp(b, t)
  145. end
  146. function AutoWeld(Foop, OOF)
  147. local W = Instance.new("Weld")
  148. W.Part0 = Foop
  149. W.Part1 = OOF
  150. local CJ = CFrame.new(Foop.Position)
  151. local C0 = Foop.CFrame:inverse()*CJ
  152. local C1 = OOF.CFrame:inverse()*CJ
  153. W.C0 = C0
  154. W.C1 = C1
  155. W.Name='o0o'
  156. W.Parent = Foop
  157.  
  158. end
  159.  
  160.  
  161.  
  162. function PlayAnimationFromTable(table, speed, bool)
  163. RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  164. Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  165. RW.C0 = clerp(RW.C0, table[3], speed)
  166. LW.C0 = clerp(LW.C0, table[4], speed)
  167. RH.C0 = clerp(RH.C0, table[5], speed)
  168. LH.C0 = clerp(LH.C0, table[6], speed)
  169. if bool == true then
  170. if resetc1 == false then
  171. resetc1 = true
  172. RootJoint.C1 = RootJoint.C1
  173. Torso.Neck.C1 = Torso.Neck.C1
  174. RW.C1 = rarmc1
  175. LW.C1 = larmc1
  176. RH.C1 = rlegc1
  177. LH.C1 = llegc1
  178. end
  179. end
  180. end
  181. sine=1
  182.  
  183. Torso.CFrame=Torso.CFrame*CFrame.new(0,1,0)
  184.  
  185.  
  186. Grass=Instance.new('Part',Character)
  187. Grass.Name='Grass'
  188. Grass.Anchored=true
  189. Grass.Size=Vector3.new(11.42, 0.17, 17.6)
  190. Grass.CFrame=Torso.CFrame*CFrame.new(-0.43, -3.905, -0.1)
  191. Grass.Material='Grass'
  192. Grass.BrickColor=BrickColor.new('Bright green')
  193. m=Instance.new('CylinderMesh',Grass)
  194. White=Instance.new('Part',Character)
  195. White.Name='White Space'
  196. White.Anchored=true
  197. White.Size=Vector3.new(35.2, 0.05, 17.6)
  198. White.CFrame=Torso.CFrame*CFrame.new(0.39, -3.965, -0.1)
  199. White.Material='Neon'
  200. White.BrickColor=BrickColor.new('Medium stone grey')
  201. m=Instance.new('CylinderMesh',White)
  202.  
  203.  
  204. Humanoid.AutoRotate=false
  205. Humanoid.WalkSpeed=0
  206. Humanoid.JumpPower=0
  207.  
  208. Flute=Instance.new('Part',Character)
  209. Flute.Name='Flute'
  210. Flute.CFrame=Torso.CFrame*CFrame.new(-0.5,-.5,-1)*CFrame.Angles(0,0,-2.5)
  211. m=Instance.new('SpecialMesh',Flute)
  212. m.MeshId='http://www.roblox.com/asset/?id=161269074'
  213. m.TextureId='http://www.roblox.com/asset/?id=228874694'
  214. m.Scale=Vector3.new(0.922, 0.922, 0.922)
  215. Flute.Size=Vector3.new(.5,2,.5)
  216.  
  217. AutoWeld(Flute,Torso)
  218. THEME=Instance.new('Sound',Character.Torso)
  219. music=nil
  220. firsttype=false
  221. Player.Chatted:connect(function(msg)
  222. for def in string.gmatch(msg, "%d+") do
  223. print(def)
  224.  
  225. if def~=nil then
  226. music=def
  227. end
  228. end
  229.  
  230. for def in string.gmatch(msg,"[%u%l%p]+") do
  231. print(def)
  232. if def=='Play/' and music~=nil then
  233. THEME:stop()
  234. THEME.SoundId='rbxassetid://'.. music
  235. THEME:play()
  236. elseif def=='Play/Demo' then
  237. THEME:stop()
  238. THEME.SoundId='rbxassetid://'.. 164167420
  239. THEME:play()
  240. elseif def=='S_Guitar' then
  241. THEME:stop()
  242. end
  243. end
  244. music=nil
  245. end)
  246. funtion(key)=f
  247. if key=='f' then
  248. if cam then
  249. cam=false
  250. CAM.CameraType='Custom'
  251. else
  252. cam=true
  253. CAM.CameraType='Scriptable'
  254. end
  255. end
  256. end)
  257.  
  258.  
  259. cam=true--Custom Camera Perspectives
  260. if cam==true then
  261. CAM.CameraType=Enum.CameraType.Scriptable
  262.  
  263. end
  264. Campart1=Instance.new('Part',Character)
  265. Campart1.Transparency=1
  266. Campart1.Anchored=true
  267. Campart1.CanCollide=false
  268. Campart2=Campart1:clone()
  269. Campart2.Parent=Character
  270. Campart3=Campart1:clone()
  271. Campart3.Parent=Character
  272.  
  273. camtime=0
  274. camphase=0
  275.  
  276. while 1 do
  277. wait()
  278. sine=sine+1
  279. PlayAnimationFromTable({
  280. CFrame.new(-math.cos(sine/16)*.2, math.cos(sine/8)/8, 0) * CFrame.Angles(0, 0, 0),
  281. CFrame.new(0, 1.5, 0) * CFrame.new(0, 0, -.3) * CFrame.Angles(-.5,0.5-THEME.PlaybackLoudness/150, 0),
  282. CFrame.new(1.5-THEME.PlaybackLoudness/700, .5, -.5)*CFrame.Angles(1.5+THEME.PlaybackLoudness/700,0,0-THEME.PlaybackLoudness/700),
  283. CFrame.new(-1.5+THEME.PlaybackLoudness/700, 0, -.5)*CFrame.Angles(1-THEME.PlaybackLoudness/700,0,0+THEME.PlaybackLoudness/700),
  284. CFrame.new(1+math.cos(sine/16)*.2,-2-math.cos(sine/8)/8, 0)*CFrame.Angles(0,0,0.5) ,
  285. CFrame.new(-1+math.cos(sine/16)*.2,-2-math.cos(sine/8)/8,0)*CFrame.Angles(0,0,-0.5),
  286. }, .3, false)
  287.  
  288. White.Size=Vector3.new(35.2+THEME.PlaybackLoudness/10, 0.05, 17.6+THEME.PlaybackLoudness/10)
  289. Campart1=Instance.new('Part')
  290. if cam==true then
  291. CAM.CameraType='Scriptable'
  292. Campart1.CFrame=Torso.CFrame*CFrame.new(8,8,8)*CFrame.Angles(-0.5,.5,-0.5)
  293. Campart2.CFrame=Torso.CFrame*CFrame.new(-8,-3,-5)*CFrame.Angles(-1,-2,-1)
  294. Campart3.CFrame=Flute.CFrame*CFrame.new(1.5,0,-1)*CFrame.Angles(0,1.8,3)
  295. if camphase==0 then
  296. if camtime<20+math.random(-2,2) then
  297. CAM.CFrame=Campart1.CFrame
  298. camtime=camtime+1
  299. else
  300. camtime=0
  301. camphase=camphase+1
  302. end
  303. elseif camphase==1 then
  304. if camtime<40+math.random(-8,12) then
  305. CAM.CFrame=Campart2.CFrame
  306. camtime=camtime+1
  307. else
  308. camtime=0
  309. camphase=camphase+1
  310. end
  311. elseif camphase==2 then
  312. if camtime<50+math.random(-2,5) then
  313. CAM.CFrame=Campart3.CFrame
  314. camtime=camtime+1
  315. else
  316. camtime=0
  317. camphase=camphase+1
  318. end
  319.  
  320. elseif camphase==3 then
  321. camphase=0
  322. end
  323.  
  324.  
  325. end
  326. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement