I’ve tried making a script for this before, but I’m very inexperienced in scripting and clearly did something wrong. Do any of you know how one would go about using TweenService on sound modifiers (e.g. distortion, pitch shift, echo)?
I highly recommend you read up on how to use Tweens. They can be used for interpolating any of the following types of data:
You can adjust the properties of an object using TweenService so long as they are of any of the types above.
local TweenService = game:GetService("TweenService")
local soundModifier = script.Parent -- We will assume it is an EchoSoundEffect for the example.
local tween = TweenService:Create(soundModifier, TweenInfo.new(1), {Delay = 1})
tween:Play() -- Echo delay gradually becomes 1 second.
In the example above, we are creating a Tween. The constructor method (TweenService:Create()
) accepts 3 arguments:
-
The first argument is the part that contains the property we want to interpolate.
-
The second argument accepts a TweenInfo object which is basically an object that contains parameters such as how long the tween will last, whether it will repeat, how smooth or animated the interpolation will be, etc. In our example, 1 is passed as the first argument in the
TweenInfo.new()
constructor, this returns a TweenInfo object that has a parameter that specifies that the interpolation will take 1 second to complete. -
The last argument accepts a dictionary of different properties and the end goal value we want to achieve for that property by the end of the tween. For example, here we pass
{Delay = 1}
. This indicates that we want the EchoSoundEffect’s Delay property to reach 1 by the end of the tween, and we can pass more than 1 property by just adding another one to the dictionary i.e. {Delay = 1, WetLevel = 0.5}
.
The TweenService:Create()
method will return a tween object which we can play using the tween:Play()
method.
Thanks! I’ll try this method out.
Are you referring to the properties of SoundEffect
instances? You’d tween them just the same as you would for the properties of other instance types.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.