Can someone explain why this isnt working?

here is my code:

local function lerpGeneral(Object,TargetSize,Time)
	local Ogscale = Object
	local StartTime = os.clock()
	local ScaleDiff = TargetSize-Ogscale

	local Hb Hb = RunService.Heartbeat:Connect(function()
		local ElapsedTime = os.clock() - StartTime
		local Alpha = ElapsedTime/Time

		if Alpha >= 1 then
			Object = TargetSize
			local ScaleN = Ogscale + (ScaleDiff * Alpha)

			Object = ScaleN
local WDrone = dispIece.CenterOut.WarblingDrone
lerpGeneral(WDrone.PitchShiftSoundEffect.Octave, 2, 5)

its supposed to gradually increase the octave of the PitchShiftSoundEffect until it gets to a specified value.

I think its because the sound:play() isnt being called inside of the lerp but if it was I would need to crate a brand new lerp for each time I need something like this done. it would no longer be lerpGeneral

I should mention that the lerp works, and there are no errors. If I put a print(Object) after Object = ScaleN I can see the size gradually increasing.

If anyone could help while keeping the lerpGeneral intact that would be fantastic thanks :grin:

1 Like

Shouldnt you index the object property with a period to modify the property instead of changing rhe local variable within the functipn?

Object.PitchSoundEffect = ScaleN