Can I use this script for a model instead of player?

I’ve got a CFrame raycast script below, which works for the player perfectly. Is it possible to modify this for a model instead, like a building model?

while true do

	local Players = game:GetService("Players")
	local player = game.Players.LocalPlayer
	local RunService = game:GetService('RunService')

	local LastHit
	local LastTrainCFrame

	local Function
	local Function2


	local Whitelist = {workspace:WaitForChild('Map1', 20)}



	Function = RunService.Heartbeat:Connect(function()
		local RootPart = player.Character.HumanoidRootPart
		local Ignore = player.Character
		local ray = Ray.new(RootPart.CFrame.p, Vector3.new(0,-200,0))
		local Hit, Position, Normal, Material
		if LastHit then
			Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,{LastHit})
			if not Hit then
				Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,Whitelist)
			end
		else
			Hit, Position, Normal, Material = workspace:FindPartOnRayWithWhitelist(ray,Whitelist)
		end
		if Hit then
			local Train = Hit
			if not LastTrainCFrame then
				LastTrainCFrame = Train.CFrame
			end
			local TrainCF
			if Train ~= LastHit and LastHit then
				TrainCF = LastHit.CFrame
			else
				TrainCF = Train.CFrame
			end
			local Rel = TrainCF * LastTrainCFrame:inverse()
			LastTrainCFrame = Train.CFrame
			RootPart.CFrame = Rel * RootPart.CFrame
			LastHit = Train
			if Train ~= LastHit then
				LastTrainCFrame = Train.CFrame
			end
		else
			LastTrainCFrame = nil
		end

		if not Function2 then
			Function2 = player.Character.Humanoid.Died:Connect(function()
				Function:Disconnect()
				Function2:Disconnect()

			end)
		end
	end)
	wait(140)
end