Script working but property of a sound wont change

  1. What do you want to achieve? Keep it simple and clear!

So, I want the pitch of a sound to ramp up when im pressing w and ramp down when im pressing anything else.

  1. What is the issue? Include screenshots / videos if possible!

So, I have all the code working and it all prints out the right numbers but the big problem is that the playbackspeed in the sounds properties isnt changing

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I havent been able to think of or find anything as to why this isnt working.

local Seat = script.Parent
local Sound = Seat.Sound.PlaybackSpeed

while wait(0.2) do
	if Seat.Throttle == 1 then
		Sound = math.clamp((Sound + 0.06),0.6,0.9)
	else
		Sound = math.clamp((Sound - 0.04),0.6,0.9)
	end
end
2 Likes
local Seat = script.Parent
local Sound = Seat.Sound

while wait(0.2) do
	if Seat.Throttle == 1 then
		Sound.PlaybackSpeed = math.clamp((Sound + 0.06),0.6,0.9)
	else
		Sound.PlaybackSpeed = math.clamp((Sound - 0.04),0.6,0.9)
	end
end
2 Likes

oh god thank u that helped a lot even if there was a small error in that code

2 Likes

You’re welcome. The problem was that you made a variable that was equal to a property of an instance.

2 Likes