Advertisement
DarkScriptZEditors

Guitar FE Testing

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