Advertisement
fusionfriends

Untitled

Mar 23rd, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. -- Visualizer by fusionfriends!! Enjoy
  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,Mouse,mouse,UserInputService,ContextActionService = owner
  4. do
  5. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  6. script.Parent = Player.Character
  7.  
  8. --RemoteEvent for communicating
  9. local Event = Instance.new("RemoteEvent")
  10. Event.Name = "UserInput_Event"
  11.  
  12. --Fake event to make stuff like Mouse.KeyDown work
  13. local function fakeEvent()
  14. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  15. t.connect = t.Connect
  16. return t
  17. end
  18.  
  19. --Creating fake input objects with fake variables
  20. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  21. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  22. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  23. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  24. end}
  25. --Merged 2 functions into one by checking amount of arguments
  26. CAS.UnbindAction = CAS.BindAction
  27.  
  28. --This function will trigger the events that have been :Connect()'ed
  29. local function te(self,ev,...)
  30. local t = m[ev]
  31. if t and t._fakeEvent and t.Function then
  32. t.Function(...)
  33. end
  34. end
  35. m.TrigEvent = te
  36. UIS.TrigEvent = te
  37.  
  38. Event.OnServerEvent:Connect(function(plr,io)
  39. if plr~=Player then return end
  40. if io.isMouse then
  41. m.Target = io.Target
  42. m.Hit = io.Hit
  43. else
  44. local b = io.UserInputState == Enum.UserInputState.Begin
  45. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  46. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  47. end
  48. for _,t in pairs(CAS.Actions) do
  49. for _,k in pairs(t.Keys) do
  50. if k==io.KeyCode then
  51. t.Function(t.Name,io.UserInputState,io)
  52. end
  53. end
  54. end
  55. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  56. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  57. end
  58. end)
  59. Event.Parent = NLS([==[
  60. local Player = game:GetService("Players").LocalPlayer
  61. local Event = script:WaitForChild("UserInput_Event")
  62.  
  63. local UIS = game:GetService("UserInputService")
  64. local input = function(io,a)
  65. if a then return end
  66. --Since InputObject is a client-side instance, we create and pass table instead
  67. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  68. end
  69. UIS.InputBegan:Connect(input)
  70. UIS.InputEnded:Connect(input)
  71.  
  72. local Mouse = Player:GetMouse()
  73. local h,t
  74. --Give the server mouse data 30 times every second, but only if the values changed
  75. --If player is not moving their mouse, client won't fire events
  76. while wait(1/30) do
  77. if h~=Mouse.Hit or t~=Mouse.Target then
  78. h,t=Mouse.Hit,Mouse.Target
  79. Event:FireServer({isMouse=true,Target=t,Hit=h})
  80. end
  81. end]==],Player.Character)
  82. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  83. end
  84. local Player = owner
  85. local Character = Player.Character
  86. local MarketplaceService = game:GetService("MarketplaceService")
  87. local Part = Instance.new("Part",workspace)
  88. local CorePart = Instance.new("Part",Character.Torso)
  89. local Weld = Instance.new("Weld",CorePart)
  90. local SurfaceGui = Instance.new("SurfaceGui",Part)
  91. local Visualizer = Instance.new("ImageLabel",SurfaceGui)
  92. local Visualizer2 = Instance.new("ImageLabel",SurfaceGui)
  93. local Name = Instance.new("TextBox",SurfaceGui)
  94. local RootPart = Character.Torso
  95.  
  96. Part.Size = Vector3.new(11,5.5,.25)
  97. Part.Material = Enum.Material.Neon
  98. Part.BrickColor = BrickColor.new("Bright red")
  99. Part.Transparency = .5
  100. Part.CanCollide = false
  101. Part.Anchored = true
  102.  
  103. CorePart.Size = Vector3.new(.5,.5,.5)
  104. CorePart.Transparency = 1
  105. CorePart.CanCollide = false
  106.  
  107. Weld.Part1 = Character.Torso
  108. Weld.Part0 = CorePart
  109. Weld.C0 = CFrame.new(0,-1,6)
  110.  
  111. local Song = Instance.new("Sound",Character.Torso)
  112. Song.Name = "Song"
  113. Song.Volume = 7
  114. Song.Looped = true
  115.  
  116. Visualizer.Size = UDim2.new(0,300,0,450)
  117. Visualizer.Position = UDim2.new(0.5,0,0.5,0)
  118. Visualizer.Image = "rbxassetid://108418574"
  119. Visualizer.BackgroundTransparency = 1
  120. Visualizer.AnchorPoint = Vector2.new(0.5,0.5)
  121.  
  122. Visualizer2.Size = UDim2.new(0,250,0,375)
  123. Visualizer2.Position = UDim2.new(0.5,0,0.5,0)
  124. Visualizer2.Image = "rbxassetid://2990022876"
  125. Visualizer2.BackgroundTransparency = 1
  126. Visualizer2.AnchorPoint = Vector2.new(0.5,0.5)
  127.  
  128. Name.Size = UDim2.new(0,300,0,50)
  129. Name.Position = UDim2.new(0,10,0,550)
  130. Name.Text = "Playing: Nothing!"
  131. Name.BackgroundTransparency = 1
  132. Name.Font = Enum.Font.Arcade
  133. Name.TextXAlignment = Enum.TextXAlignment.Left
  134. Name.TextSize = 20
  135.  
  136. local LoudnessEvent = Instance.new("RemoteEvent")
  137. LoudnessEvent.Name = "LoudnessEvent"
  138. LoudnessEvent.Parent = NLS([==[
  139. local LoudnessEvent = script.LoudnessEvent
  140. local Song = game.Players.LocalPlayer.Character.Torso.Song
  141. game:GetService("RunService").Heartbeat:Connect(function()
  142. LoudnessEvent:FireServer(Song.PlaybackLoudness)
  143. end)
  144. ]==],owner.PlayerGui)
  145.  
  146. spawn(function()
  147. local function onLoudnessEvent(Player,PL)
  148. local Loudness = PL
  149. Part.CFrame = CFrame.new(CorePart.Position)*CFrame.Angles(math.rad(CorePart.Orientation.X),math.rad(CorePart.Orientation.Y+180),math.rad(CorePart.Orientation.Z))
  150. Visualizer.Size = UDim2.new(Loudness/2000,300,Loudness/1800,450)
  151. Visualizer2.Size = UDim2.new(Loudness/2000,250,Loudness/1800,375)
  152. end
  153. LoudnessEvent.OnServerEvent:Connect(onLoudnessEvent)
  154. Player.Chatted:Connect(function(Message)
  155. if Message:sub(1,5) == "Play/" then
  156. local Id = Message:sub(6,#Message)
  157. if tonumber (Id) then
  158. Song.SoundId = ("rbxassetid://"..Id)
  159. Song:Play()
  160. local SongInfo = MarketplaceService:GetProductInfo(Id,Enum.InfoType.Asset)
  161. Name.Text = ("Playing: "..SongInfo.Name)
  162. end
  163. end
  164. if Message:sub(1,6) == "Color/" then
  165. local Color = Message:sub(7,#Message)
  166. if tostring (Color) then
  167. Part.BrickColor = BrickColor.new(Color)
  168. end
  169. end
  170. end)
  171. end)
  172. print"fusionfriends' visualizer has been loaded!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement