Advertisement
kkbr11022

Untitled

Apr 28th, 2025
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. local hax = script.Parent
  2. local Face = hax.Face
  3. local Audio = Face.Audio
  4. --local Output = Face.Output
  5. --local Wire = Face.Wire
  6. --Wire.SourceInstance = Audio
  7. --Wire.TargetInstance = Output
  8. local Image = Face.Image
  9. local Click = Face.Click
  10.  
  11. local Length = Audio.TimeLength
  12. local Seq = NumberSequence.new(0, Length)
  13. local Count = Length*10
  14. local Playing = false
  15. function Play()
  16.   if Playing ~= false then return end
  17.   assert(Audio.Asset, `Audio "{Audio.Asset}" is nil`)
  18.   assert(Audio.IsReady, `Audio "{Audio.Asset}" is not ready.`)
  19.   Playing=true
  20.   local Before = Face.Size
  21.   local function clp(x)
  22.     return math.clamp(x, 0.05, 1)
  23.   end
  24.   Click:Remove()
  25.   local Waves = Audio:GetWaveformAsync(Seq, Count)
  26.   Audio:Play()
  27.   for _, i in pairs(Waves) do
  28.     local Speed = Audio.PlaybackSpeed
  29.     local Volume = math.clamp(Audio.Volume, 0, 3)
  30.     local Time = (Length/Count)/Speed
  31.     i=i*10
  32.     if i<0.2 then i=0 end
  33.     local X,Y,Z=clp(i), clp(i), Before.Z
  34.     Face.Size = Before+Vector3.new(X*Volume,Y*Volume,Z)
  35.     if Time==0 then continue end
  36.     wait(Time)
  37.   end
  38.   Face.Size = Before
  39.   Audio:Stop()
  40.   Playing=false
  41.   Click.Parent=Face
  42. end
  43.  
  44. Click.MouseClick:Connect(Play)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement