Advertisement
samuelrichter66

guitar

May 23rd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.85 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.  
  154. print('Guitar')
  155. print('By slenercat5')
  156. print('F to toggle Camera perspectives')--FANCY :D
  157. Player=game.Players.LocalPlayer
  158. Character=Player.Character
  159. Character.Animate.Disabled=true
  160. local LeftArm = Character["Left Arm"]
  161. local RightArm = Character["Right Arm"]
  162. local LeftLeg = Character["Left Leg"]
  163. local RightLeg = Character["Right Leg"]
  164. local Head = Character.Head
  165. local Torso = Character.Torso
  166. local Camera = game.Workspace.CurrentCamera
  167. local RootPart = Character.HumanoidRootPart
  168. local RootJoint = RootPart.RootJoint
  169. local Humanoid=Character.Humanoid
  170. CAM=Camera
  171. FF=Instance.new('ForceField',Character)
  172. FF.Visible=false
  173. Humanoid.Name='LOLOL YOU CANT HIT ME'
  174. Character.
  175. Health:remove()
  176. for i,v in pairs (Humanoid:GetPlayingAnimationTracks()) do
  177. v:Stop()
  178. end
  179.  
  180. local newMotor = function(part0, part1, c0, c1)
  181. w = Instance.new('Motor')
  182. w.Parent = part0
  183. w.Part0 = part0
  184. w.Part1 = part1
  185. w.C0 = c0
  186. w.C1 = c1
  187.  
  188. return w
  189. end
  190.  
  191.  
  192.  
  193.  
  194. RootCF = CFrame.fromEulerAnglesXYZ(-1.57, 0, 3.14)
  195. NeckCF = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  196.  
  197. local RW = newMotor(Torso, RightArm, CFrame.new(2.5, 0, 0), CFrame.new(0, 0, 0))
  198. local LW = newMotor(Torso, LeftArm, CFrame.new(-2.5, 0, 0), CFrame.new(0, 0, 0))
  199. local RH = newMotor(Torso, RightLeg, CFrame.new(1.5, -3, 0), CFrame.new(0, 0, 0))
  200. local LH = newMotor(Torso, LeftLeg, CFrame.new(-1.5, -3, 0), CFrame.new(0, 0, 0))
  201. RootJoint.C1 = CFrame.new(0, 0, 0)
  202. RootJoint.C0 = CFrame.new(0, 0, 0)
  203. Torso.Neck.C1 = CFrame.new(0, 0, 0)
  204. Torso.Neck.C0 = CFrame.new(0, 2.5, 0)
  205.  
  206. local rarmc1 = RW.C1
  207. local larmc1 = LW.C1
  208. local rlegc1 = RH.C1
  209. local llegc1 = LH.C1
  210.  
  211. local resetc1 = false
  212.  
  213. function clerp(a, b, t)
  214. return a:lerp(b, t)
  215. end
  216. function AutoWeld(Foop, OOF)
  217. local W = Instance.new("Weld")
  218. W.Part0 = Foop
  219. W.Part1 = OOF
  220. local CJ = CFrame.new(Foop.Position)
  221. local C0 = Foop.CFrame:inverse()*CJ
  222. local C1 = OOF.CFrame:inverse()*CJ
  223. W.C0 = C0
  224. W.C1 = C1
  225. W.Name='o0o'
  226. W.Parent = Foop
  227.  
  228. end
  229.  
  230.  
  231.  
  232. function PlayAnimationFromTable(table, speed, bool)
  233. RootJoint.C0 = clerp(RootJoint.C0, table[1], speed)
  234. Torso.Neck.C0 = clerp(Torso.Neck.C0, table[2], speed)
  235. RW.C0 = clerp(RW.C0, table[3], speed)
  236. LW.C0 = clerp(LW.C0, table[4], speed)
  237. RH.C0 = clerp(RH.C0, table[5], speed)
  238. LH.C0 = clerp(LH.C0, table[6], speed)
  239. if bool == true then
  240. if resetc1 == false then
  241. resetc1 = true
  242. RootJoint.C1 = RootJoint.C1
  243. Torso.Neck.C1 = Torso.Neck.C1
  244. RW.C1 = rarmc1
  245. LW.C1 = larmc1
  246. RH.C1 = rlegc1
  247. LH.C1 = llegc1
  248. end
  249. end
  250. end
  251. sine=1
  252.  
  253. Torso.CFrame=Torso.CFrame*CFrame.new(0,1,0)
  254.  
  255.  
  256. Grass=Instance.new('Part',Character)
  257. Grass.Name='Grass'
  258. Grass.Anchored=true
  259. Grass.Size=Vector3.new(11.42, 0.17, 17.6)
  260. Grass.CFrame=Torso.CFrame*CFrame.new(-0.43, -3.905, -0.1)
  261. Grass.Material='Grass'
  262. Grass.BrickColor=BrickColor.new('Bright green')
  263. m=Instance.new('CylinderMesh',Grass)
  264. White=Instance.new('Part',Character)
  265. White.Name='White Space'
  266. White.Anchored=true
  267. White.Size=Vector3.new(35.2, 0.05, 17.6)
  268. White.CFrame=Torso.CFrame*CFrame.new(0.39, -3.965, -0.1)
  269. White.Material='Neon'
  270. White.BrickColor=BrickColor.new('Medium stone grey')
  271. m=Instance.new('CylinderMesh',White)
  272.  
  273.  
  274. Humanoid.AutoRotate=false
  275. Humanoid.WalkSpeed=0
  276. Humanoid.JumpPower=0
  277.  
  278. Flute=Instance.new('Part',Character)
  279. Flute.Name='Flute'
  280. Flute.CFrame=Torso.CFrame*CFrame.new(-0.5,-.5,-1)*CFrame.Angles(0,0,-2.5)
  281. m=Instance.new('SpecialMesh',Flute)
  282. m.MeshId='http://www.roblox.com/asset/?id=161269074'
  283. m.TextureId='http://www.roblox.com/asset/?id=228874694'
  284. m.Scale=Vector3.new(0.922, 0.922, 0.922)
  285. Flute.Size=Vector3.new(.5,2,.5)
  286.  
  287. AutoWeld(Flute,Torso)
  288. THEME=Instance.new('Sound',Character.Torso)
  289. music=nil
  290. firsttype=false
  291. Player.Chatted:connect(function(msg)
  292. for def in string.gmatch(msg, "%d+") do
  293. print(def)
  294.  
  295. if def~=nil then
  296. music=def
  297. end
  298. end
  299.  
  300. for def in string.gmatch(msg,"[%u%l%p]+") do
  301. print(def)
  302. if def=='Play/' and music~=nil then
  303. THEME:stop()
  304. THEME.SoundId='rbxassetid://'.. music
  305. THEME:play()
  306. elseif def=='Play/Demo' then
  307. THEME:stop()
  308. THEME.SoundId='rbxassetid://'.. 164167420
  309. THEME:play()
  310. elseif def=='S_Guitar' then
  311. THEME:stop()
  312. end
  313. end
  314. music=nil
  315. end)
  316. Ms=Player:GetMouse()
  317. Ms.KeyDown:connect(function(key)
  318. if key=='f' then
  319. if cam then
  320. cam=false
  321. CAM.CameraType='Custom'
  322. else
  323. cam=true
  324. CAM.CameraType='Scriptable'
  325. end
  326. end
  327. end)
  328.  
  329.  
  330. cam=true--Custom Camera Perspectives
  331. if cam==true then
  332. CAM.CameraType=Enum.CameraType.Scriptable
  333.  
  334. end
  335. Campart1=Instance.new('Part',Character)
  336. Campart1.Transparency=1
  337. Campart1.Anchored=true
  338. Campart1.CanCollide=false
  339. Campart2=Campart1:clone()
  340. Campart2.Parent=Character
  341. Campart3=Campart1:clone()
  342. Campart3.Parent=Character
  343.  
  344. camtime=0
  345. camphase=0
  346.  
  347. while 1 do
  348. wait()
  349. sine=sine+1
  350. PlayAnimationFromTable({
  351. CFrame.new(-math.cos(sine/16)*.2, math.cos(sine/8)/8, 0) * CFrame.Angles(0, 0, 0),
  352. CFrame.new(0, 1.5, 0) * CFrame.new(0, 0, -.3) * CFrame.Angles(-.5,0.5-THEME.PlaybackLoudness/150, 0),
  353. CFrame.new(1.5-THEME.PlaybackLoudness/700, .5, -.5)*CFrame.Angles(1.5+THEME.PlaybackLoudness/700,0,0-THEME.PlaybackLoudness/700),
  354. CFrame.new(-1.5+THEME.PlaybackLoudness/700, 0, -.5)*CFrame.Angles(1-THEME.PlaybackLoudness/700,0,0+THEME.PlaybackLoudness/700),
  355. CFrame.new(1+math.cos(sine/16)*.2,-2-math.cos(sine/8)/8, 0)*CFrame.Angles(0,0,0.5) ,
  356. CFrame.new(-1+math.cos(sine/16)*.2,-2-math.cos(sine/8)/8,0)*CFrame.Angles(0,0,-0.5),
  357. }, .3, false)
  358.  
  359. White.Size=Vector3.new(35.2+THEME.PlaybackLoudness/10, 0.05, 17.6+THEME.PlaybackLoudness/10)
  360. Campart1=Instance.new('Part')
  361. if cam==true then
  362. CAM.CameraType='Scriptable'
  363. Campart1.CFrame=Torso.CFrame*CFrame.new(8,8,8)*CFrame.Angles(-0.5,.5,-0.5)
  364. Campart2.CFrame=Torso.CFrame*CFrame.new(-8,-3,-5)*CFrame.Angles(-1,-2,-1)
  365. Campart3.CFrame=Flute.CFrame*CFrame.new(1.5,0,-1)*CFrame.Angles(0,1.8,3)
  366. if camphase==0 then
  367. if camtime<20+math.random(-2,2) then
  368. CAM.CFrame=Campart1.CFrame
  369. camtime=camtime+1
  370. else
  371. camtime=0
  372. camphase=camphase+1
  373. end
  374. elseif camphase==1 then
  375. if camtime<40+math.random(-8,12) then
  376. CAM.CFrame=Campart2.CFrame
  377. camtime=camtime+1
  378. else
  379. camtime=0
  380. camphase=camphase+1
  381. end
  382. elseif camphase==2 then
  383. if camtime<50+math.random(-2,5) then
  384. CAM.CFrame=Campart3.CFrame
  385. camtime=camtime+1
  386. else
  387. camtime=0
  388. camphase=camphase+1
  389. end
  390.  
  391. elseif camphase==3 then
  392. camphase=0
  393. end
  394.  
  395.  
  396. end
  397. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement