Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hax = script.Parent
- local Face = hax.Face
- local Audio = Face.Audio
- --local Output = Face.Output
- --local Wire = Face.Wire
- --Wire.SourceInstance = Audio
- --Wire.TargetInstance = Output
- local Image = Face.Image
- local Click = Face.Click
- local Length = Audio.TimeLength
- local Seq = NumberSequence.new(0, Length)
- local Count = Length*10
- local Playing = false
- function Play()
- if Playing ~= false then return end
- assert(Audio.Asset, `Audio "{Audio.Asset}" is nil`)
- assert(Audio.IsReady, `Audio "{Audio.Asset}" is not ready.`)
- Playing=true
- local Before = Face.Size
- local function clp(x)
- return math.clamp(x, 0.05, 1)
- end
- Click:Remove()
- local Waves = Audio:GetWaveformAsync(Seq, Count)
- Audio:Play()
- for _, i in pairs(Waves) do
- local Speed = Audio.PlaybackSpeed
- local Volume = math.clamp(Audio.Volume, 0, 3)
- local Time = (Length/Count)/Speed
- i=i*10
- if i<0.2 then i=0 end
- local X,Y,Z=clp(i), clp(i), Before.Z
- Face.Size = Before+Vector3.new(X*Volume,Y*Volume,Z)
- if Time==0 then continue end
- wait(Time)
- end
- Face.Size = Before
- Audio:Stop()
- Playing=false
- Click.Parent=Face
- end
- Click.MouseClick:Connect(Play)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement