This script is practically thanks to my friend, but as a challenge, I decided to see if I can implement the repeating faster and slower sound (as explained in the title). Problem is, I was stuck pretty much instantly and decided to come here to see if anybody else knew the problem, I will provide all of the script here, but it's pretty much notably the spawn(function() part. The example is shown below:
local Player = game:GetService("Players").LocalPlayer; local PlayerGui = Player:WaitForChild("PlayerGui"); local Sound = Instance.new("Sound", PlayerGui); Sound.SoundId = "rbxassetid://1011469175"; Sound.Volume = 1; Sound.Looped = false; local NPC = workspace:WaitForChild("EliteBananaSquad"); local NPC_Head = NPC:WaitForChild("Head"); local Character = Player.Character or Player.CharacterAdded:Wait(); local Head = Character:WaitForChild("Head"); Player.CharacterAdded:Connect(function(New_Character) Character = New_Character; Head = Character:WaitForChild("Head"); end); spawn(function() while (true) do Sound:Play(); wait((Head.Position - NPC_Head.Position).Magnitude) end end); while (wait()) do if (Head) then Sound.Volume = math.clamp(1 / (Head.Position - NPC_Head.Position).magnitude, 0, 1); end end