HowToRoblox

NotificationHandler

Apr 3rd, 2021 (edited)
2,290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local mps = game:GetService("MarketplaceService")
  2.  
  3. local music = workspace:WaitForChild("CurrentMusic")
  4.  
  5. local clipping = script.Parent:WaitForChild("NotifierClipping")
  6. local notifBG = clipping.NotifierBG
  7. local musicName = notifBG.MusicName
  8.  
  9.  
  10. notifBG.Position = UDim2.new(-1, 0, 0.5, 0)
  11.  
  12.  
  13. function updateMusic()
  14.  
  15.     local id = string.gsub(music.SoundId, "rbxassetid://", "")
  16.  
  17.  
  18.     local success, info = pcall(mps.GetProductInfo, mps, id)
  19.  
  20.     if success then
  21.  
  22.         musicName.Text = info.Name
  23.  
  24.  
  25.         notifBG:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
  26.         wait(5)
  27.         notifBG:TweenPosition(UDim2.new(-1, 0, 0.5, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
  28.     end
  29. end
  30.  
  31.  
  32. updateMusic()
  33.  
  34.  
  35. music:GetPropertyChangedSignal("SoundId"):Connect(updateMusic)
Add Comment
Please, Sign In to add comment