Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Sound volume based on player speed broken?

Asked by
Burobuu 18
4 years ago

This script basically functions by taking the speed of a player and dividing it by a reasonable amount to add a "wind background" while they're moving along. The script is under a screengui and two frames. I have the basic function below, I was trying to attempt to have the sound only play for the player alone but I got an error saying Failed to load sound 3308152153: Unable to download sound data (x2) Is there any way I can avoid this or fix this problem? Thanks in advance!


--player = boop = game.Players.LocalPlayer if boop.Character then player = boop.Character end --sound = local sound = Instance.new("Sound") -- make sound sound.SoundId = "3308152153" -- put the ID of your sound here sound.Parent = player -- put sound in player repeat wait() until sound.Loaded == true -- wait until it is loaded sound.Looped = true sound.Volume = 0 sound:Play() -- play the sound wait(1) while true do a = math.floor(player.Head.Velocity.magnitude*10)/10 script.Parent.SpeedValue.Text = (a) if a < 30.1 then sound.volume=0 elseif a > 30 and a < 70.1 then sound.volume= a/25 else sound.volume= a/20 end wait(0.1) end

Answer this question