Check if your camera is in a moving part

Hello, so I got an idea, for one of my games. Basically, if your camera is inside of a moving region, it changes the sound in a part.
I looked on google, and couldn’t find a stable solution.
Any help is appreciated.


local Run = game:GetService("RunService")

local Camera = workspace.CurrentCamera

local OldCFrame =, 0, 0)

local Part ="Part")
Part.Anchored = true
Part.CFrame = OldCFrame
Part.Parent = workspace

local Sound ="Sound")
Sound.SoundId = "rbxassetid://0" --Change 0 to ID of audio.
Sound.Parent = script

Camera.CameraSubject = Part

	local NewCFrame = Part.CFrame
	if NewCFrame ~= OldCFrame then --Checks if part moved in last frame.
		if not Sound.IsPlaying then --Checks if the sound is already playing.
			Sound:Play() --Plays sound if it is not already playing.
		OldCFrame = NewCFrame
	else --Checks if part did not move in the last frame.
		if Sound.IsPlaying then --Checks if sound is playing.
			Sound:Stop() --Stops sound if it is playing.

Just a bare-bones script but this is essentially what you’re looking for.

Hello thanks for the help, but as I stated, the region moves (its on a vehicle), and also there will be multiple of them (which need to do same thing). Do you have any idea on how to make that?