DrakerMaker

singing visualizer

Sep 10th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. function wb(first,second,c0)
  2. local weld = Instance.new("Weld", first)
  3. weld.Part0 = first
  4. weld.Part1 = second
  5. weld.C0 = second.CFrame:inverse() *second.CFrame *c0
  6. return weld
  7. end
  8. pbl = 0
  9. weld = wb(owner.Character.Head, owner.Character.Torso, CFrame.new(0,-1.46,0))
  10. local music = Instance.new("Sound", owner.Character.Head)
  11. music.SoundId = "rbxassetid://2410687447"
  12. music.Volume = 2
  13. music.Looped = true
  14. music:Play()
  15. music.Name = "Song"
  16. local remote = Instance.new("RemoteEvent", owner.Character)
  17. remote.Name = "SoundAlert"
  18. owner.Character.Head:FindFirstChildOfClass("Decal").Texture = "http://www.roblox.com/asset/?id=8056256"
  19. a = [[
  20. spawn(function()
  21. Music = owner.Character.Head.Song
  22. Event = owner.Character.SoundAlert
  23. RunService = game:GetService("RunService")
  24. RunService.RenderStepped:Connect(function()
  25. Event:FireServer(Music.PlaybackLoudness)
  26. end)
  27. end)
  28. ]]
  29. NLS(a,owner.Character)
  30. remote.OnServerEvent:connect(function(P,X)
  31. pbl = X
  32. end)
  33. owner.Chatted:connect(function(msg)
  34. if msg:sub(1,4) == "play" then
  35. music:Stop()
  36. music.SoundId = "rbxassetid://"..msg:sub(6)
  37. music:Play()
  38. end
  39. if msg == "stop" then
  40. music:Stop()
  41. end
  42. if msg == "resume" then
  43. music:Resume()
  44. end
  45. if msg:sub(1,5) == "pitch" then
  46. music.PlaybackSpeed = msg:sub(7)
  47. end
  48. end)
  49. while game:GetService("RunService").Stepped:wait() do
  50. local goal = {}
  51. goal.C0 = owner.Character.Torso.CFrame:inverse() *owner.Character.Torso.CFrame *CFrame.new(0,-1.46, pbl/300) *CFrame.Angles(-pbl/300,0,0)
  52. local tweeninfo = TweenInfo.new(0.5)
  53. local tween = game:GetService("TweenService"):Create(weld, tweeninfo, goal)
  54. tween:Play()
  55. if pbl > 120 then
  56. owner.Character.Head:FindFirstChildOfClass("Decal").Texture = "http://www.roblox.com/asset/?id=1110715143"
  57. end
  58. if pbl < 119 then
  59. owner.Character.Head:FindFirstChildOfClass("Decal").Texture = "http://www.roblox.com/asset/?id=8056256"
  60. end
  61. end
Add Comment
Please, Sign In to add comment