How to make this relative to orientation

So I have this code:

local RunService = game:GetService("RunService")

local Arrow = workspace.Arrow

local A = 45
local f = 1
local w = 2 * math.pi * f
local p = 0
local k = 1

local function f(t)
	return A * math.cos(w * t + p) * math.pow(math.exp(t), -k * t)
end

local function OnRenderStepped()
	Arrow.Orientation = Vector3.new(0, f(time()), 0)
	return
end

RunService.Heartbeat:Connect(OnRenderStepped)

it does this

but it has a problem which is that it is does not do that relative to the parts orientation which means when I do this:

which is not what I want it to do I want it to act like it did in the first clip but do it whenever you change its orientation. How can I do this.

1 Like

I might just be stupid, but these videos look like they’re doing the same thing.

Can you explain what you want in a different and slower way?